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