1- import { INestApplication } from " @nestjs/common" ;
2- import { Test } from " @nestjs/testing" ;
3- import * as request from " supertest" ;
4- import AxiosMockAdapter from " axios-mock-adapter" ;
1+ import { INestApplication } from ' @nestjs/common' ;
2+ import { Test } from ' @nestjs/testing' ;
3+ import * as request from ' supertest' ;
4+ import AxiosMockAdapter from ' axios-mock-adapter' ;
55
6- import { OrdersModule , PaymentStatus } from " ../src/orders" ;
6+ import { OrdersModule , PaymentStatus } from ' ../src/orders' ;
77
88let app : INestApplication ;
99let axiosMock : AxiosMockAdapter ;
1010
1111/**
1212 * for brevity
1313 */
14- const paymentGatewayUrl = " http://localhost:1337" ;
14+ const paymentGatewayUrl = ' http://localhost:1337' ;
1515process . env . PAYMENT_GATEWAY = paymentGatewayUrl ;
1616
1717beforeAll ( async ( ) => {
1818 const moduleFixture = await Test . createTestingModule ( {
19- imports : [ OrdersModule ]
19+ imports : [ OrdersModule ] ,
2020 } ) . compile ( ) ;
2121
2222 app = moduleFixture . createNestApplication ( ) ;
2323 await app . init ( ) ;
2424
2525 // bind interceptor, force throw on any non-mocked route
26- axiosMock = new AxiosMockAdapter ( app . get ( " AXIOS_INSTANCE_TOKEN" ) , {
27- onNoMatch : " throwException"
26+ axiosMock = new AxiosMockAdapter ( app . get ( ' AXIOS_INSTANCE_TOKEN' ) , {
27+ onNoMatch : ' throwException' ,
2828 } ) ;
2929} ) ;
3030
3131describe ( `when order was submitted` , ( ) => {
32- const uuid = " test-order-uuid" ;
32+ const uuid = ' test-order-uuid' ;
3333
3434 beforeEach ( ( ) => {
3535 // "configure" responses
@@ -40,19 +40,19 @@ describe(`when order was submitted`, () => {
4040 . replyOnce ( 200 , { } )
4141 . onGet ( paymentGatewayUrl + `/${ uuid } ` )
4242 . replyOnce ( 200 , {
43- status : PaymentStatus . Pending
43+ status : PaymentStatus . Pending ,
4444 } )
4545 . onGet ( paymentGatewayUrl + `/${ uuid } ` )
4646 . replyOnce ( 200 , {
47- status : PaymentStatus . Approved
47+ status : PaymentStatus . Approved ,
4848 } ) ;
4949 } ) ;
5050
51- it ( " should ACK the order" , ( ) => {
51+ it ( ' should ACK the order' , ( ) => {
5252 return request ( app . getHttpServer ( ) )
53- . post ( "/" )
53+ . post ( '/' )
5454 . send ( {
55- uuid
55+ uuid,
5656 } )
5757 . expect ( 201 ) ;
5858 } ) ;
@@ -72,11 +72,10 @@ describe(`when order was submitted`, () => {
7272 return request ( app . getHttpServer ( ) )
7373 . get ( `/${ uuid } ` )
7474 . expect ( 200 )
75- . then ( res => {
75+ . then ( ( res ) => {
7676 expect ( res . body . status ) . toEqual ( PaymentStatus . Approved ) ;
7777 } ) ;
7878 } ) ;
7979 } ) ;
8080 } ) ;
81-
82- } ) ;
81+ } ) ;
0 commit comments