@@ -53,15 +53,54 @@ describe('encrypted schema declaration', function() {
5353          assert . deepEqual ( schema . _buildSchemaMap ( ) ,  schemaMap ) ; 
5454        } ) ; 
5555
56-         encryptionType  ===  'qe '  &&  it ( 'then the generated encryptedFieldsMap is correct' ,  function ( )  { 
56+         encryptionType  ===  'queryableEncryption '  &&  it ( 'then the generated encryptedFieldsMap is correct' ,  function ( )  { 
5757          assert . deepEqual ( schema . _buildEncryptedFields ( ) ,  encryptedFields ) ; 
5858        } ) ; 
5959      } ) ; 
6060    } 
6161  } ) ; 
6262
6363  describe ( 'Tests that fields of valid schema types can be declared as encrypted schemas' ,  function ( )  { 
64-     it ( 'nested schema for csfle' ,  function ( )  { 
64+     it ( 'mongoose maps with csfle' ,  function ( )  { 
65+       const  schema  =  new  Schema ( { 
66+         field : { 
67+           type : Schema . Types . Map , 
68+           of : String , 
69+           encrypt : {  keyId : [ KEY_ID ] ,  algorithm } 
70+         } 
71+       } ,  {  encryptionType : 'csfle'  } ) ; 
72+ 
73+       assert . ok ( schemaHasEncryptedProperty ( schema ,  'field' ) ) ; 
74+ 
75+       assert . deepEqual ( schema . _buildSchemaMap ( ) ,  { 
76+         bsonType : 'object' , 
77+         properties : { 
78+           field : {  encrypt : { 
79+             bsonType : 'object' ,  algorithm,  keyId : [ KEY_ID ] 
80+           }  } 
81+         } 
82+       } ) ; 
83+     } ) ; 
84+ 
85+     it ( 'mongoose maps with queryableEncryption' ,  function ( )  { 
86+       const  schema  =  new  Schema ( { 
87+         field : { 
88+           type : Schema . Types . Map , 
89+           of : String , 
90+           encrypt : {  keyId : KEY_ID  } 
91+         } 
92+       } ,  {  encryptionType : 'queryableEncryption'  } ) ; 
93+ 
94+       assert . ok ( schemaHasEncryptedProperty ( schema ,  'field' ) ) ; 
95+ 
96+       assert . deepEqual ( schema . _buildEncryptedFields ( ) ,  { 
97+         fields : [ 
98+           {  path : 'field' ,  keyId : KEY_ID ,  bsonType : 'object'  } 
99+         ] 
100+       } ) ; 
101+     } ) ; 
102+ 
103+     it ( 'subdocument for csfle' ,  function ( )  { 
65104      const  encryptedSchema  =  new  Schema ( { 
66105        encrypted : { 
67106          type : String ,  encrypt : {  keyId : KEY_ID ,  algorithm } 
@@ -85,15 +124,15 @@ describe('encrypted schema declaration', function() {
85124        } 
86125      } ) ; 
87126    } ) ; 
88-     it ( 'nested schema  for qe ' ,  function ( )  { 
127+     it ( 'subdocument  for queryableEncryption ' ,  function ( )  { 
89128      const  encryptedSchema  =  new  Schema ( { 
90129        encrypted : { 
91130          type : String ,  encrypt : {  keyId : KEY_ID  } 
92131        } 
93-       } ,  {  encryptionType : 'qe '  } ) ; 
132+       } ,  {  encryptionType : 'queryableEncryption '  } ) ; 
94133      const  schema  =  new  Schema ( { 
95134        field : encryptedSchema 
96-       } ,  {  encryptionType : 'qe '  } ) ; 
135+       } ,  {  encryptionType : 'queryableEncryption '  } ) ; 
97136      assert . ok ( schemaHasEncryptedProperty ( schema ,  [ 'field' ,  'encrypted' ] ) ) ; 
98137
99138      assert . deepEqual ( schema . _buildEncryptedFields ( ) ,  { 
@@ -123,14 +162,14 @@ describe('encrypted schema declaration', function() {
123162        } 
124163      } ) ; 
125164    } ) ; 
126-     it ( 'nested object for qe ' ,  function ( )  { 
165+     it ( 'nested object for queryableEncryption ' ,  function ( )  { 
127166      const  schema  =  new  Schema ( { 
128167        field : { 
129168          encrypted : { 
130169            type : String ,  encrypt : {  keyId : KEY_ID  } 
131170          } 
132171        } 
133-       } ,  {  encryptionType : 'qe '  } ) ; 
172+       } ,  {  encryptionType : 'queryableEncryption '  } ) ; 
134173      assert . ok ( schemaHasEncryptedProperty ( schema ,  [ 'field' ,  'encrypted' ] ) ) ; 
135174      assert . deepEqual ( schema . _buildEncryptedFields ( ) ,  { 
136175        fields : [ 
@@ -160,13 +199,13 @@ describe('encrypted schema declaration', function() {
160199        } 
161200      } ) ; 
162201    } ) ; 
163-     it ( 'schema with encrypted array for qe ' ,  function ( )  { 
202+     it ( 'schema with encrypted array for queryableEncryption ' ,  function ( )  { 
164203      const  schema  =  new  Schema ( { 
165204        encrypted : { 
166205          type : [ Number ] , 
167206          encrypt : {  keyId : KEY_ID  } 
168207        } 
169-       } ,  {  encryptionType : 'qe '  } ) ; 
208+       } ,  {  encryptionType : 'queryableEncryption '  } ) ; 
170209      assert . ok ( schemaHasEncryptedProperty ( schema ,  [ 'encrypted' ] ) ) ; 
171210      assert . deepEqual ( schema . _buildEncryptedFields ( ) ,  { 
172211        fields : [ 
@@ -633,7 +672,7 @@ function primitiveSchemaMapTests() {
633672    { 
634673      name : 'string' , 
635674      type : String , 
636-       encryptionType : 'qe ' , 
675+       encryptionType : 'queryableEncryption ' , 
637676      schemaMap : { 
638677        bsonType : 'object' , 
639678        properties : { 
@@ -684,7 +723,7 @@ function primitiveSchemaMapTests() {
684723    } , 
685724    { 
686725      name : 'boolean' , 
687-       encryptionType : 'qe ' , 
726+       encryptionType : 'queryableEncryption ' , 
688727      type : Schema . Types . Boolean , 
689728      schemaMap : { 
690729        bsonType : 'object' , 
@@ -736,7 +775,7 @@ function primitiveSchemaMapTests() {
736775    } , 
737776    { 
738777      name : 'buffer' , 
739-       encryptionType : 'qe ' , 
778+       encryptionType : 'queryableEncryption ' , 
740779      type : Schema . Types . Buffer , 
741780      schemaMap : { 
742781        bsonType : 'object' , 
@@ -788,7 +827,7 @@ function primitiveSchemaMapTests() {
788827    } , 
789828    { 
790829      name : 'date' , 
791-       encryptionType : 'qe ' , 
830+       encryptionType : 'queryableEncryption ' , 
792831      type : Date , 
793832      schemaMap : { 
794833        bsonType : 'object' , 
@@ -840,7 +879,7 @@ function primitiveSchemaMapTests() {
840879    } , 
841880    { 
842881      name : 'objectid' , 
843-       encryptionType : 'qe ' , 
882+       encryptionType : 'queryableEncryption ' , 
844883      type : ObjectId , 
845884      schemaMap : { 
846885        bsonType : 'object' , 
@@ -892,7 +931,7 @@ function primitiveSchemaMapTests() {
892931    } , 
893932    { 
894933      name : 'bigint' , 
895-       encryptionType : 'qe ' , 
934+       encryptionType : 'queryableEncryption ' , 
896935      type : BigInt , 
897936      schemaMap : { 
898937        bsonType : 'object' , 
@@ -944,7 +983,7 @@ function primitiveSchemaMapTests() {
944983    } , 
945984    { 
946985      name : 'Decimal128' , 
947-       encryptionType : 'qe ' , 
986+       encryptionType : 'queryableEncryption ' , 
948987      type : Decimal128 , 
949988      schemaMap : { 
950989        bsonType : 'object' , 
@@ -996,7 +1035,7 @@ function primitiveSchemaMapTests() {
9961035    } , 
9971036    { 
9981037      name : 'int32' , 
999-       encryptionType : 'qe ' , 
1038+       encryptionType : 'queryableEncryption ' , 
10001039      type : Int32 , 
10011040      schemaMap : { 
10021041        bsonType : 'object' , 
@@ -1048,7 +1087,7 @@ function primitiveSchemaMapTests() {
10481087    } , 
10491088    { 
10501089      name : 'double' , 
1051-       encryptionType : 'qe ' , 
1090+       encryptionType : 'queryableEncryption ' , 
10521091      type : Double , 
10531092      schemaMap : { 
10541093        bsonType : 'object' , 
0 commit comments