File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
test/integration/client-side-encryption Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,49 @@ describe('Client Side Encryption Functional', function () {
53
53
}
54
54
} ) ;
55
55
56
+ describe ( 'Collection' , function ( ) {
57
+ describe ( '#bulkWrite()' , function ( ) {
58
+ context ( 'when encryption errors' , function ( ) {
59
+ let client ;
60
+
61
+ beforeEach ( function ( ) {
62
+ client = this . configuration . newClient ( { } , {
63
+ autoEncryption : {
64
+ keyVaultNamespace : 'test.keyvault' ,
65
+ kmsProviders : {
66
+ local : {
67
+ key : 'A' . repeat ( 128 )
68
+ }
69
+ } ,
70
+ encryptedFieldsMap : {
71
+ 'test.coll' : {
72
+ fields : [ {
73
+ path : 'ssn' ,
74
+ keyId : new BSON . UUID ( '23f786b4-1d39-4c36-ae88-70a663321ec9' ) . toBinary ( ) ,
75
+ bsonType : 'string'
76
+ } ]
77
+ }
78
+ }
79
+ }
80
+ } ) ;
81
+ } ) ;
82
+
83
+ afterEach ( async function ( ) {
84
+ await client ?. close ( ) ;
85
+ } ) ;
86
+
87
+ it ( 'bubbles up the mongocrypt error' , async function ( ) {
88
+ try {
89
+ await client . db ( 'test' ) . collection ( 'coll' ) . bulkWrite ( [ { insertOne : { ssn : 'foo' } } ] ) ;
90
+ expect . fail ( 'expected error to be thrown' ) ;
91
+ } catch ( error ) {
92
+ expect ( error . message ) . to . equal ( 'not all keys requested were satisfied' ) ;
93
+ }
94
+ } ) ;
95
+ } ) ;
96
+ } ) ;
97
+ } ) ;
98
+
56
99
describe ( 'BSON Options' , function ( ) {
57
100
beforeEach ( function ( ) {
58
101
this . client = this . configuration . newClient ( ) ;
You can’t perform that action at this time.
0 commit comments