|
1 | | -import { test, expect, request } from '@playwright/test'; |
2 | | -import { SUPPLIER_API_URL_SANDBOX, SUPPLIER_LETTERS} from '../constants/api-constants'; |
3 | | -import { apiSandboxGetLettersRequestTestData } from './testCases/get-list-of-letters-test-cases'; |
| 1 | +import { expect, test } from "@playwright/test"; |
| 2 | +import { |
| 3 | + SUPPLIER_API_URL_SANDBOX, |
| 4 | + SUPPLIER_LETTERS, |
| 5 | +} from "../constants/api-constants"; |
| 6 | +import { apiSandboxGetLettersRequestTestData } from "./testCases/get-list-of-letters-test-cases"; |
4 | 7 |
|
5 | | - |
6 | | -test.describe('Sandbox Tests To Get List Of Pending Letters ', () => |
7 | | -{ |
8 | | - apiSandboxGetLettersRequestTestData.forEach(({ testCase, header, limit, expectedStatus, expectedResponse }) => { |
| 8 | +test.describe("Sandbox Tests To Get List Of Pending Letters ", () => { |
| 9 | + for (const { |
| 10 | + expectedResponse, |
| 11 | + expectedStatus, |
| 12 | + header, |
| 13 | + limit, |
| 14 | + testCase, |
| 15 | + } of apiSandboxGetLettersRequestTestData) { |
9 | 16 | test(`Get /Letters endpoint returns ${testCase}`, async ({ request }) => { |
10 | | - |
11 | | - const response = await request.get(`${SUPPLIER_API_URL_SANDBOX}/${SUPPLIER_LETTERS}` ,{ |
12 | | - headers: header, |
13 | | - params:{ |
14 | | - limit: limit |
15 | | - }, |
| 17 | + const response = await request.get( |
| 18 | + `${SUPPLIER_API_URL_SANDBOX}/${SUPPLIER_LETTERS}`, |
| 19 | + { |
| 20 | + headers: header, |
| 21 | + params: { |
| 22 | + limit, |
16 | 23 | }, |
17 | | - ); |
| 24 | + }, |
| 25 | + ); |
18 | 26 |
|
19 | 27 | const res = await response.json(); |
20 | 28 | await expect(response.status()).toBe(expectedStatus); |
21 | 29 | expect(res).toEqual(expectedResponse); |
22 | | - if (response.status() === 200){ |
| 30 | + if (response.status() === 200) { |
23 | 31 | expect(res.data.length.toString()).toEqual(limit); |
24 | 32 | } |
25 | 33 | }); |
26 | | - }); |
| 34 | + } |
27 | 35 | }); |
0 commit comments