@@ -78,6 +78,11 @@ describe('Errors', function() {
78
78
} ) ;
79
79
} ) ;
80
80
81
+ const PROJECTION_ERRORS = new Set ( [
82
+ 'Projection cannot have a mix of inclusion and exclusion.' ,
83
+ 'Cannot do exclusion on field b in inclusion projection'
84
+ ] ) ;
85
+
81
86
it ( 'should return an error object with message when mixing included and excluded fields' , {
82
87
metadata : { requires : { mongodb : '>3.0' } } ,
83
88
test : function ( done ) {
@@ -86,7 +91,7 @@ describe('Errors', function() {
86
91
c . insertOne ( { a : 2 , b : 5 } , { w : 1 } , err => {
87
92
expect ( err ) . to . not . exist ;
88
93
c . findOne ( { a : 2 } , { fields : { a : 1 , b : 0 } } , err => {
89
- expect ( err . errmsg ) . to . equal ( 'Projection cannot have a mix of inclusion and exclusion.' ) ;
94
+ expect ( PROJECTION_ERRORS ) . to . include ( err . errmsg ) ;
90
95
done ( ) ;
91
96
} ) ;
92
97
} ) ;
@@ -99,7 +104,7 @@ describe('Errors', function() {
99
104
const db = client . db ( this . configuration . db ) ;
100
105
const c = db . collection ( 'test_error_object_should_include_message' ) ;
101
106
c . findOne ( { } , { fields : { a : 1 , b : 0 } } , err => {
102
- expect ( err . errmsg ) . to . equal ( 'Projection cannot have a mix of inclusion and exclusion.' ) ;
107
+ expect ( PROJECTION_ERRORS ) . to . include ( err . errmsg ) ;
103
108
done ( ) ;
104
109
} ) ;
105
110
}
0 commit comments