|
|
@ -1,3 +1,6 @@ |
|
|
|
|
|
|
|
// 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 { Test, TestingModule } from '@nestjs/testing'; |
|
|
|
import { INestApplication } from '@nestjs/common'; |
|
|
|
import { INestApplication } from '@nestjs/common'; |
|
|
|
import request from 'supertest'; |
|
|
|
import request from 'supertest'; |
|
|
@ -15,10 +18,28 @@ describe('AppController (e2e)', () => { |
|
|
|
await app.init(); |
|
|
|
await app.init(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('/ (GET)', () => { |
|
|
|
it('/packages/UPS/TN12345679 (GET)', () => { |
|
|
|
return request(app.getHttpServer()) |
|
|
|
return request(app.getHttpServer()) |
|
|
|
.get('/') |
|
|
|
.get(`/packages/UPS/TN12345679`) |
|
|
|
.expect(200) |
|
|
|
.expect(200) |
|
|
|
.expect('Hello World!'); |
|
|
|
.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(); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|