You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
45 lines
1.8 KiB
45 lines
1.8 KiB
// 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();
|
|
});
|
|
});
|
|
});
|
|
|