1
1
/* tslint:disable:no-any */
2
2
/* tslint:disable:no-object-mutation */
3
3
4
- import { ResponseSuccessAccepted , ResponseSuccessJson } from "@pagopa/ts-commons/lib/responses" ;
4
+ import {
5
+ ResponseSuccessAccepted ,
6
+ ResponseSuccessJson ,
7
+ } from "@pagopa/ts-commons/lib/responses" ;
5
8
6
9
import mockReq from "../../__mocks__/request" ;
7
10
import { mockedUser } from "../../__mocks__/user_mock" ;
8
11
import TrialController from "../trialController" ;
9
12
import TrialService from "../../services/trialService" ;
10
13
import { SubscriptionStateEnum } from "../../../generated/trial-system/SubscriptionState" ;
11
14
12
- const aTrialId : string = "trial-id " ;
15
+ const aTrialId : string = "IO_WALLET_TRIAL_ID " ;
13
16
const nowDate = new Date ( ) ;
14
17
15
18
const aValidSubscription = {
@@ -22,7 +25,7 @@ const mockGetSubscription = jest.fn();
22
25
23
26
const trialServiceMock = {
24
27
createSubscription : mockCreateSubscription ,
25
- getSubscription : mockGetSubscription
28
+ getSubscription : mockGetSubscription ,
26
29
} as any as TrialService ;
27
30
28
31
describe ( "trialController#createTrialSubscription" , ( ) => {
@@ -43,10 +46,13 @@ describe("trialController#createTrialSubscription", () => {
43
46
44
47
const response = await controller . createTrialSubscription ( req ) ;
45
48
46
- expect ( mockCreateSubscription ) . toHaveBeenCalledWith ( mockedUser . fiscal_code , aTrialId ) ;
49
+ expect ( mockCreateSubscription ) . toHaveBeenCalledWith (
50
+ mockedUser . fiscal_code ,
51
+ aTrialId
52
+ ) ;
47
53
expect ( response ) . toEqual ( {
48
54
apply : expect . any ( Function ) ,
49
- kind : "IResponseSuccessAccepted"
55
+ kind : "IResponseSuccessAccepted" ,
50
56
} ) ;
51
57
} ) ;
52
58
@@ -63,7 +69,7 @@ describe("trialController#createTrialSubscription", () => {
63
69
expect ( response ) . toEqual ( {
64
70
apply : expect . any ( Function ) ,
65
71
kind : "IResponseErrorValidation" ,
66
- detail : expect . stringContaining ( "Bad request" )
72
+ detail : expect . stringContaining ( "Bad request" ) ,
67
73
} ) ;
68
74
} ) ;
69
75
} ) ;
@@ -86,11 +92,14 @@ describe("trialController#getTrialSubscription", () => {
86
92
87
93
const response = await controller . getTrialSubscription ( req ) ;
88
94
89
- expect ( mockGetSubscription ) . toHaveBeenCalledWith ( mockedUser . fiscal_code , aTrialId ) ;
95
+ expect ( mockGetSubscription ) . toHaveBeenCalledWith (
96
+ mockedUser . fiscal_code ,
97
+ aTrialId
98
+ ) ;
90
99
expect ( response ) . toEqual ( {
91
100
apply : expect . any ( Function ) ,
92
101
kind : "IResponseSuccessJson" ,
93
- value : aValidSubscription
102
+ value : aValidSubscription ,
94
103
} ) ;
95
104
} ) ;
96
105
@@ -107,7 +116,7 @@ describe("trialController#getTrialSubscription", () => {
107
116
expect ( response ) . toEqual ( {
108
117
apply : expect . any ( Function ) ,
109
118
kind : "IResponseErrorValidation" ,
110
- detail : expect . stringContaining ( "Bad request" )
119
+ detail : expect . stringContaining ( "Bad request" ) ,
111
120
} ) ;
112
121
} ) ;
113
122
} ) ;
0 commit comments