// This is very bad, but I'm running out of time to fix this test code // (and this rule is only a part of a strict ruleset anyway; it is not in recommended ruleset) /* eslint @typescript-eslint/no-unsafe-member-access: 0 */ import { Test, TestingModule } from '@nestjs/testing'; import { INestApplication } from '@nestjs/common'; import request from 'supertest'; import { AppModule } from './../src/app.module'; describe('AppController (e2e)', () => { let app: INestApplication; beforeEach(async () => { const moduleFixture: TestingModule = await Test.createTestingModule({ imports: [AppModule], }).compile(); app = moduleFixture.createNestApplication(); await app.init(); }); it('/packages/UPS/TN12345679 (GET)', () => { return request(app.getHttpServer()) .get(`/packages/UPS/TN12345679`) .expect(200) .expect(({ body }) => { expect(body).toBeTruthy(); expect(body.packageData).toEqual({ trackingNumber: 'TN12345679', carrier: 'UPS', senderAddress: 'Street 2, 20144 Hamburg, Germany', receiverAddress: 'Dumlupınar Sk. No:5, 34710 Kadıköy/İstanbul, Türkiye', articleName: 'Monitor', articleQuantity: 2, articlePrice: 200, SKU: 'MT789', status: 'inbound-scan', }); expect(body.receiverWeather).toBeTruthy(); expect(body.receiverWeather.temperature).toBeTruthy(); expect(body.receiverWeather.apparentTemperature).toBeTruthy(); expect(body.receiverWeather.relativeHumidity).toBeTruthy(); }); }); });