@@ -5,12 +5,6 @@ import { env } from 'process';
5
5
import { ClientEncryption } from '../../../src/client-side-encryption/client_encryption' ;
6
6
import { Binary } from '../../mongodb' ;
7
7
8
- const metadata : MongoDBMetadataUI = {
9
- requires : {
10
- clientSideEncryption : true
11
- }
12
- } as const ;
13
-
14
8
const dataKeyOptions = {
15
9
masterKey : {
16
10
projectId : 'devprod-drivers' ,
@@ -45,25 +39,39 @@ describe('17. On-demand GCP Credentials', () => {
45
39
await keyVaultClient ?. close ( ) ;
46
40
} ) ;
47
41
48
- it ( 'Case 1: Failure' , metadata , async function ( ) {
49
- if ( env . EXPECTED_GCPKMS_OUTCOME !== 'failure' ) {
50
- this . skipReason = 'This test is supposed to run in the environment where failure is expected' ;
51
- this . skip ( ) ;
42
+ it (
43
+ 'Case 1: Failure' ,
44
+ {
45
+ requires : {
46
+ predicate : ( ) =>
47
+ env . EXPECTED_GCPKMS_OUTCOME !== 'failure'
48
+ ? 'This test is supposed to run in the environment where failure is expected'
49
+ : true
50
+ }
51
+ } ,
52
+ async function ( ) {
53
+ const error = await clientEncryption
54
+ . createDataKey ( 'gcp' , dataKeyOptions )
55
+ . catch ( error => error ) ;
56
+ // GaxiosError: Unsuccessful response status code. Request failed with status code 404
57
+ expect ( error ) . to . be . instanceOf ( Error ) ;
58
+ expect ( error ) . property ( 'code' , '404' ) ;
52
59
}
60
+ ) ;
53
61
54
- const error = await clientEncryption . createDataKey ( 'gcp' , dataKeyOptions ) . catch ( error => error ) ;
55
- // GaxiosError: Unsuccessful response status code. Request failed with status code 404
56
- expect ( error ) . to . be . instanceOf ( Error ) ;
57
- expect ( error ) . property ( 'code' , '404' ) ;
58
- } ) ;
59
-
60
- it ( 'Case 2: Success' , metadata , async function ( ) {
61
- if ( env . EXPECTED_GCPKMS_OUTCOME !== 'success' ) {
62
- this . skipReason = 'This test is supposed to run in the environment where success is expected' ;
63
- this . skip ( ) ;
62
+ it (
63
+ 'Case 2: Success' ,
64
+ {
65
+ requires : {
66
+ predicate : ( ) =>
67
+ env . EXPECTED_GCPKMS_OUTCOME !== 'success'
68
+ ? 'This test is supposed to run in the environment where success is expected'
69
+ : true
70
+ }
71
+ } ,
72
+ async function ( ) {
73
+ const dk = await clientEncryption . createDataKey ( 'gcp' , dataKeyOptions ) ;
74
+ expect ( dk ) . to . be . instanceOf ( Binary ) ;
64
75
}
65
-
66
- const dk = await clientEncryption . createDataKey ( 'gcp' , dataKeyOptions ) ;
67
- expect ( dk ) . to . be . instanceOf ( Binary ) ;
68
- } ) ;
76
+ ) ;
69
77
} ) ;
0 commit comments