11import { Chance } from 'chance'
22import { Nfses } from '..'
33import { InMemoryBlingRepository } from '../../../repositories/bling-in-memory.repository'
4- import cancelResponse from './cancel-response'
4+ import cancelResponse , { cancelRequest } from './cancel-response'
55import createResponse , { createRequestBody } from './create-response'
66import deleteResponse from './delete-response'
77import findResponse from './find-response'
@@ -11,6 +11,11 @@ import sendResponse from './send-response'
1111import updateConfigurationsResponse , {
1212 updateConfigurationsRequestBody
1313} from './update-configurations-response'
14+ import { IGetResponse } from '../interfaces/get.interface'
15+ import { IFindResponse } from '../interfaces/find.interface'
16+ import { IGetConfigurationsResponse } from '../interfaces/get-configurations.interface'
17+ import { ICreateResponse } from '../interfaces/create.interface'
18+ import { ISendResponse } from '../interfaces/send.interface'
1419
1520const chance = Chance ( )
1621
@@ -39,6 +44,9 @@ describe('NFS-es entity', () => {
3944 id : String ( idNotaServico )
4045 } )
4146 expect ( response ) . toBe ( deleteResponse )
47+
48+ const typingResponseTest : null = deleteResponse
49+ expect ( typingResponseTest ) . toBe ( deleteResponse )
4250 } )
4351
4452 it ( 'should get successfully' , async ( ) => {
@@ -59,6 +67,9 @@ describe('NFS-es entity', () => {
5967 }
6068 } )
6169 expect ( response ) . toBe ( getResponse )
70+
71+ const typingResponseTest : IGetResponse = getResponse
72+ expect ( typingResponseTest ) . toBe ( getResponse )
6273 } )
6374
6475 it ( 'should find successfully' , async ( ) => {
@@ -73,6 +84,9 @@ describe('NFS-es entity', () => {
7384 id : String ( idNotaServico )
7485 } )
7586 expect ( response ) . toBe ( findResponse )
87+
88+ const typingResponseTest : IFindResponse = findResponse
89+ expect ( typingResponseTest ) . toBe ( findResponse )
7690 } )
7791
7892 it ( 'should get configurations successfully' , async ( ) => {
@@ -85,6 +99,9 @@ describe('NFS-es entity', () => {
8599 endpoint : 'nfse/configuracoes'
86100 } )
87101 expect ( response ) . toBe ( getConfigurationsResponse )
102+
103+ const typingResponseTest : IGetConfigurationsResponse = getConfigurationsResponse
104+ expect ( typingResponseTest ) . toBe ( getConfigurationsResponse )
88105 } )
89106
90107 it ( 'should create successfully' , async ( ) => {
@@ -98,6 +115,9 @@ describe('NFS-es entity', () => {
98115 body : createRequestBody
99116 } )
100117 expect ( response ) . toBe ( createResponse )
118+
119+ const typingResponseTest : ICreateResponse = createResponse
120+ expect ( typingResponseTest ) . toBe ( createResponse )
101121 } )
102122
103123 it ( 'should send successfully' , async ( ) => {
@@ -112,20 +132,26 @@ describe('NFS-es entity', () => {
112132 body : { }
113133 } )
114134 expect ( response ) . toBe ( sendResponse )
135+
136+ const typingResponseTest : ISendResponse = sendResponse
137+ expect ( typingResponseTest ) . toBe ( sendResponse )
115138 } )
116139
117140 it ( 'should cancel successfully' , async ( ) => {
118141 const spy = jest . spyOn ( repository , 'store' )
119142 const idNotaServico = chance . natural ( )
120143 repository . setResponse ( cancelResponse )
121144
122- const response = await entity . cancel ( { idNotaServico } )
145+ const response = await entity . cancel ( { idNotaServico, ... cancelRequest } )
123146
124147 expect ( spy ) . toHaveBeenCalledWith ( {
125148 endpoint : `nfse/${ idNotaServico } /cancelar` ,
126- body : { }
149+ body : cancelRequest
127150 } )
128151 expect ( response ) . toBe ( cancelResponse )
152+
153+ const typingResponseTest : null = cancelResponse
154+ expect ( typingResponseTest ) . toBe ( cancelResponse )
129155 } )
130156
131157 it ( 'should update configurations successfully' , async ( ) => {
@@ -142,5 +168,8 @@ describe('NFS-es entity', () => {
142168 body : updateConfigurationsRequestBody
143169 } )
144170 expect ( response ) . toBe ( updateConfigurationsResponse )
171+
172+ const typingResponseTest : null = updateConfigurationsResponse
173+ expect ( typingResponseTest ) . toBe ( updateConfigurationsResponse )
145174 } )
146175} )
0 commit comments