11import * as assert from 'assert' ;
22import * as t from 'io-ts' ;
3- import { DecryptRequestBody , PostDecrypt } from '../../../src/typedRoutes/api/common/decrypt' ;
3+ import { DecryptRequestBody , PostV1Decrypt } from '../../../src/typedRoutes/api/v1/decrypt' ;
4+ import { PostV2Decrypt } from '../../../src/typedRoutes/api/v2/decrypt' ;
45import { assertDecode } from './common' ;
56import 'should' ;
67import 'should-http' ;
@@ -65,7 +66,7 @@ describe('Decrypt codec tests', function () {
6566 } ) ;
6667
6768 describe ( 'DecryptResponse' , function ( ) {
68- const DecryptResponse = PostDecrypt . response [ 200 ] ;
69+ const DecryptResponse = PostV1Decrypt . response [ 200 ] ;
6970
7071 it ( 'should validate response with required field' , function ( ) {
7172 const validResponse = {
@@ -112,24 +113,41 @@ describe('Decrypt codec tests', function () {
112113 } ) ;
113114 } ) ;
114115
115- describe ( 'PostDecrypt route definition' , function ( ) {
116+ describe ( 'PostV1Decrypt route definition' , function ( ) {
116117 it ( 'should have the correct path' , function ( ) {
117- assert . strictEqual ( PostDecrypt . path , '/api/v[12] /decrypt' ) ;
118+ assert . strictEqual ( PostV1Decrypt . path , '/api/v1 /decrypt' ) ;
118119 } ) ;
119120
120121 it ( 'should have the correct HTTP method' , function ( ) {
121- assert . strictEqual ( PostDecrypt . method , 'POST' ) ;
122+ assert . strictEqual ( PostV1Decrypt . method , 'POST' ) ;
122123 } ) ;
123124
124125 it ( 'should have the correct request configuration' , function ( ) {
125- // Verify the route is configured with a request property
126- assert . ok ( PostDecrypt . request ) ;
126+ assert . ok ( PostV1Decrypt . request ) ;
127127 } ) ;
128128
129129 it ( 'should have the correct response types' , function ( ) {
130- // Check that the response object has the expected status codes
131- assert . ok ( PostDecrypt . response [ 200 ] ) ;
132- assert . ok ( PostDecrypt . response [ 404 ] ) ;
130+ assert . ok ( PostV1Decrypt . response [ 200 ] ) ;
131+ assert . ok ( PostV1Decrypt . response [ 404 ] ) ;
132+ } ) ;
133+ } ) ;
134+
135+ describe ( 'PostV2Decrypt route definition' , function ( ) {
136+ it ( 'should have the correct path' , function ( ) {
137+ assert . strictEqual ( PostV2Decrypt . path , '/api/v2/decrypt' ) ;
138+ } ) ;
139+
140+ it ( 'should have the correct HTTP method' , function ( ) {
141+ assert . strictEqual ( PostV2Decrypt . method , 'POST' ) ;
142+ } ) ;
143+
144+ it ( 'should have the correct request configuration' , function ( ) {
145+ assert . ok ( PostV2Decrypt . request ) ;
146+ } ) ;
147+
148+ it ( 'should have the correct response types' , function ( ) {
149+ assert . ok ( PostV2Decrypt . response [ 200 ] ) ;
150+ assert . ok ( PostV2Decrypt . response [ 404 ] ) ;
133151 } ) ;
134152 } ) ;
135153
@@ -164,7 +182,7 @@ describe('Decrypt codec tests', function () {
164182 result . body . should . have . property ( 'decrypted' ) ;
165183 assert . strictEqual ( result . body . decrypted , mockDecryptResponse ) ;
166184
167- const decodedResponse = assertDecode ( PostDecrypt . response [ 200 ] , result . body ) ;
185+ const decodedResponse = assertDecode ( PostV1Decrypt . response [ 200 ] , result . body ) ;
168186 assert . strictEqual ( decodedResponse . decrypted , mockDecryptResponse ) ;
169187 } ) ;
170188
@@ -186,7 +204,7 @@ describe('Decrypt codec tests', function () {
186204 result . body . should . have . property ( 'decrypted' ) ;
187205 assert . strictEqual ( result . body . decrypted , mockDecryptResponse ) ;
188206
189- const decodedResponse = assertDecode ( PostDecrypt . response [ 200 ] , result . body ) ;
207+ const decodedResponse = assertDecode ( PostV2Decrypt . response [ 200 ] , result . body ) ;
190208 assert . strictEqual ( decodedResponse . decrypted , mockDecryptResponse ) ;
191209 } ) ;
192210
@@ -208,7 +226,7 @@ describe('Decrypt codec tests', function () {
208226 assert . strictEqual ( result . status , 200 ) ;
209227 assert . strictEqual ( result . body . decrypted , mockLongDecrypted ) ;
210228
211- const decodedResponse = assertDecode ( PostDecrypt . response [ 200 ] , result . body ) ;
229+ const decodedResponse = assertDecode ( PostV1Decrypt . response [ 200 ] , result . body ) ;
212230 assert . strictEqual ( decodedResponse . decrypted , mockLongDecrypted ) ;
213231 } ) ;
214232
@@ -229,7 +247,7 @@ describe('Decrypt codec tests', function () {
229247 assert . strictEqual ( result . status , 200 ) ;
230248 assert . strictEqual ( result . body . decrypted , mockDecryptResponse ) ;
231249
232- const decodedResponse = assertDecode ( PostDecrypt . response [ 200 ] , result . body ) ;
250+ const decodedResponse = assertDecode ( PostV2Decrypt . response [ 200 ] , result . body ) ;
233251 assert . ok ( decodedResponse ) ;
234252 } ) ;
235253 } ) ;
0 commit comments