Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e190e56

Browse files
committed
Push broken test to confirm build failure.
1 parent 32a27b2 commit e190e56

File tree

1 file changed

+43
-5
lines changed

1 file changed

+43
-5
lines changed

example/ts/test/exampleApiTests.ts

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,55 @@ function createFetchResponse(status: number, body?: any) {
2020

2121
describe('createHttpClient', () => {
2222

23-
it('get widgets returns 200', () => {
23+
it('get widget with ID', () => {
2424
return createHttpClient({
2525
fetch: (uri, request) => {
26-
uri.should.equal('http://local.example.com/v1/widgets');
26+
uri.should.equal('http://local.example.com/v1/widgets/xyzzy');
2727
request.method.should.equal('GET');
2828
expect(request.headers).to.not.exist;
2929
expect(request.body).to.not.exist;
30-
return createFetchResponse(200, {});
30+
return createFetchResponse(200, {
31+
id: 'xyzzy',
32+
name: 'Xyzzy'
33+
});
3134
}
32-
}).getWidgets({}).then(result => {
33-
result.value.should.deep.equal({});
35+
}).getWidget({
36+
id: 'xyzzy'
37+
}).then(result => {
38+
result.value.should.deep.equal({
39+
widget: {
40+
id: 'xyzzy',
41+
name: 'Xyzzy'
42+
}
43+
});
44+
});
45+
});
46+
47+
it('get widget with missing ID', () => {
48+
return createHttpClient({
49+
fetch: (uri, request) => {
50+
throw new Error();
51+
}
52+
}).getWidget({}).then(result => {
53+
result.error.should.deep.equal({
54+
code: 'invalidRequest',
55+
message: 'The request field \'id\' is required.'
56+
})
57+
});
58+
});
59+
60+
it('get widget with blank ID', () => {
61+
return createHttpClient({
62+
fetch: (uri, request) => {
63+
throw new Error();
64+
}
65+
}).getWidget({
66+
id: ''
67+
}).then(result => {
68+
result.error.should.deep.equal({
69+
code: 'invalidRequest',
70+
message: 'The request field \'id\' is required.'
71+
})
3472
});
3573
});
3674

0 commit comments

Comments
 (0)