Skip to content

Commit 3a8d21e

Browse files
resolved v12-15 test cases
1 parent f9d27e6 commit 3a8d21e

File tree

3 files changed

+2
-39
lines changed

3 files changed

+2
-39
lines changed

tests/lib/aes.test.js

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ describe('lib/aes', () => {
108108
aes.encrypt()
109109
}).throw(TypeError, {
110110
code: 'ERR_INVALID_ARG_TYPE',
111-
message: 'The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined',
112-
stack: /at prepareSecretKey \(internal\/crypto\/keys\.js/,
113111
})
114112
})
115113

@@ -118,17 +116,13 @@ describe('lib/aes', () => {
118116
aes.encrypt(undefined, '')
119117
}).throw(TypeError, {
120118
code: 'ERR_INVALID_ARG_TYPE',
121-
message: 'The "iv" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined',
122-
stack: /at Cipheriv\.createCipherWithIV/,
123119
})
124120
})
125121

126122
it('method `encrypt` should thrown Error when length of the `iv` is invalid', () => {
127123
should(() => {
128124
aes.encrypt('', '')
129125
}).throw(Error, {
130-
message: 'Invalid IV length',
131-
stack: /at Cipheriv\.createCipherBase/,
132126
})
133127
})
134128

@@ -149,8 +143,6 @@ describe('lib/aes', () => {
149143
aes.encrypt(mockupIv, mockupKey)
150144
}).throw(TypeError, {
151145
code: 'ERR_INVALID_ARG_TYPE',
152-
message: 'The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined',
153-
stack: /at Cipheriv\.update/,
154146
})
155147
})
156148

@@ -161,8 +153,6 @@ describe('lib/aes', () => {
161153
aes.encrypt(mockupIv, mockupKey, '', 1)
162154
}).throw(TypeError, {
163155
code: 'ERR_INVALID_ARG_TYPE',
164-
message: 'The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (1)',
165-
stack: /at Function\.from \(buffer\.js/,
166156
})
167157
})
168158

@@ -194,8 +184,6 @@ describe('lib/aes', () => {
194184
aes.decrypt()
195185
}).throw(TypeError, {
196186
code: 'ERR_INVALID_ARG_TYPE',
197-
message: 'The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined',
198-
stack: /at Function\.from \(buffer\.js/,
199187
})
200188
})
201189

@@ -204,8 +192,6 @@ describe('lib/aes', () => {
204192
aes.decrypt(undefined, undefined, '')
205193
}).throw(TypeError, {
206194
code: 'ERR_INVALID_ARG_TYPE',
207-
message: 'The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined',
208-
stack: /at prepareSecretKey \(internal\/crypto\/keys\.js/,
209195
})
210196
})
211197

@@ -214,17 +200,13 @@ describe('lib/aes', () => {
214200
aes.decrypt(undefined, '', '')
215201
}).throw(TypeError, {
216202
code: 'ERR_INVALID_ARG_TYPE',
217-
message: 'The "iv" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined',
218-
stack: /at Decipheriv\.createCipherWithIV/,
219203
})
220204
})
221205

222206
it('method `decrypt` should thrown Error when length of the `iv` is invalid', () => {
223207
should(() => {
224208
aes.decrypt('', '', '')
225209
}).throw(Error, {
226-
message: 'Invalid IV length',
227-
stack: /at Decipheriv\.createCipherBase/,
228210
})
229211
})
230212

@@ -262,8 +244,6 @@ describe('lib/aes', () => {
262244
aes.decrypt(mockupIv, mockupKey, 'GvpmmdtYwexXIPhySs9Tlg==', 1)
263245
}).throw(TypeError, {
264246
code: 'ERR_INVALID_ARG_TYPE',
265-
message: 'The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received type number (1)',
266-
stack: /at Function\.from \(buffer\.js/,
267247
})
268248
})
269249

tests/lib/formatter.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ describe('lib/formatter', () => {
2121
fmt.castCsvBill()
2222
}).throw(TypeError, {
2323
code: 'ERR_INVALID_ARG_TYPE',
24-
message: 'The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined',
25-
stack: /at Function\.from \(buffer\.js/
2624
})
2725
})
2826

tests/lib/rsa.test.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ describe('lib/rsa', () => {
3535
should(() => {
3636
rsa.encrypt('', '')
3737
}).throw(Error, {
38-
code: 'ERR_OSSL_BIO_NULL_PARAMETER',
39-
function: 'BIO_new_mem_buf',
40-
message: 'error:2007E073:BIO routines:BIO_new_mem_buf:null parameter',
41-
stack: /at Object\.publicEncrypt \(internal\/crypto\/cipher\.js/
38+
code: /ERR_OSSL_BIO_NULL_PARAMETER|ERR_OSSL_PEM_NO_START_LINE/,
4239
})
4340
})
4441

@@ -83,10 +80,7 @@ describe('lib/rsa', () => {
8380
should(() => {
8481
rsa.decrypt('', '')
8582
}).throw(Error, {
86-
code: 'ERR_OSSL_BIO_NULL_PARAMETER',
87-
function: 'BIO_new_mem_buf',
88-
message: 'error:2007E073:BIO routines:BIO_new_mem_buf:null parameter',
89-
stack: /at Object\.privateDecrypt \(internal\/crypto\/cipher\.js/
83+
code: /ERR_OSSL_BIO_NULL_PARAMETER|ERR_OSSL_PEM_NO_START_LINE/,
9084
})
9185
})
9286

@@ -99,8 +93,6 @@ describe('lib/rsa', () => {
9993
rsa.decrypt('', privateKey)
10094
}).throw(Error, {
10195
code: 'ERR_OSSL_RSA_OAEP_DECODING_ERROR',
102-
function: 'RSA_padding_check_PKCS1_OAEP_mgf1',
103-
message: 'error:04099079:rsa routines:RSA_padding_check_PKCS1_OAEP_mgf1:oaep decoding error',
10496
})
10597
})
10698

@@ -146,8 +138,6 @@ describe('lib/rsa', () => {
146138
rsa.sign()
147139
}).throw(TypeError, {
148140
code: 'ERR_INVALID_ARG_TYPE',
149-
message: 'The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined',
150-
stack: /at Sign\.update \(internal\/crypto\/sig\.js/
151141
})
152142
})
153143

@@ -195,8 +185,6 @@ describe('lib/rsa', () => {
195185
rsa.verify()
196186
}).throw(TypeError, {
197187
code: 'ERR_INVALID_ARG_TYPE',
198-
message: 'The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined',
199-
stack: /at Verify\.update \(internal\/crypto\/sig\.js/
200188
})
201189
})
202190

@@ -205,7 +193,6 @@ describe('lib/rsa', () => {
205193
rsa.verify('')
206194
}).throw(TypeError, {
207195
code: 'ERR_INVALID_ARG_TYPE',
208-
message: 'The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined',
209196
})
210197
})
211198

@@ -214,7 +201,6 @@ describe('lib/rsa', () => {
214201
rsa.verify('', '')
215202
}).throw(TypeError, {
216203
code: 'ERR_INVALID_ARG_TYPE',
217-
message: 'The "key" argument must be of type string or an instance of Buffer, TypedArray, DataView, or KeyObject. Received undefined',
218204
})
219205
})
220206

@@ -226,7 +212,6 @@ describe('lib/rsa', () => {
226212
rsa.verify('', undefined, cert)
227213
}).throw(TypeError, {
228214
code: 'ERR_INVALID_ARG_TYPE',
229-
message: 'The "signature" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received undefined',
230215
})
231216
})
232217

0 commit comments

Comments
 (0)