-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpokeapi.test.ts
More file actions
32 lines (28 loc) · 948 Bytes
/
pokeapi.test.ts
File metadata and controls
32 lines (28 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { TestSuite } from '../src/types/index.js';
const suite: TestSuite = {
name: 'PokeAPI Health Check',
tests: [
{
name: 'should fetch ditto data',
run: async (ctx) => {
const res = await ctx.request({
url: 'https://pokeapi.co/api/v2/pokemon/ditto',
method: 'GET',
});
ctx.expect(res).toHaveStatus(200);
ctx.expect(res.body.name).toBe('ditto');
},
},
{
name: 'should fail on non-existent pokemon',
run: async (ctx) => {
const res = await ctx.request({
url: 'https://pokeapi.co/api/v2/pokemon/non-existent-12345',
method: 'GET',
});
ctx.expect(res).toHaveStatus(404);
},
}
],
};
export default suite;