1 | import SDK from "./index";
|
2 |
|
3 | const sdk = new SDK({ base: "http://localhost:3000" });
|
4 |
|
5 | describe("## SDK vehicle", () => {
|
6 | it("should list pets", async () => {
|
7 | const result = await sdk.pet.listPets();
|
8 | expect(result.body.length).toBe(100);
|
9 | });
|
10 |
|
11 | let pet;
|
12 |
|
13 | it("should create pet", async () => {
|
14 | const newPet = {
|
15 | name: "jam",
|
16 | tag: "DOG",
|
17 | owner: "lily",
|
18 | };
|
19 |
|
20 | const result = await sdk.pet.createPet({ body: newPet });
|
21 | pet = result.body;
|
22 | expect(pet).toMatchObject(newPet);
|
23 | });
|
24 |
|
25 | it("should get pet", async () => {
|
26 | const result = await sdk.pet.showPetById({
|
27 | petId: pet.id,
|
28 | });
|
29 | expect(result.body.id).toBe(pet.id);
|
30 | });
|
31 |
|
32 | it("should delete pet", async () => {
|
33 | const result = await sdk.pet.deletePet({
|
34 | petId: pet.id,
|
35 | });
|
36 | expect(result.body).toEqual({});
|
37 | });
|
38 | });
|