You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -15,107 +15,105 @@ describe('test.type.js', function () {
15
15
]);
16
16
});
17
17
18
-
it('does null',function(){
19
-
vardb=context.db;
20
-
returndb.find({
18
+
it('does null',async()=>{
19
+
constdb=context.db;
20
+
constres=awaitdb.find({
21
21
selector: {
22
22
'foo': {$type: 'null'}
23
23
},
24
24
fields: ['_id']
25
-
}).then(function(res){
26
-
res.docs.sort(sortById);
27
-
res.docs.should.deep.equal([{_id: 'c'}]);
28
25
});
26
+
res.docs.sort(sortById);
27
+
res.docs.should.deep.equal([{_id: 'c'}]);
29
28
});
30
29
31
-
it('does boolean',function(){
32
-
vardb=context.db;
33
-
returndb.find({
30
+
it('does boolean',async()=>{
31
+
constdb=context.db;
32
+
constres=awaitdb.find({
34
33
selector: {
35
34
'foo': {$type: 'boolean'}
36
35
},
37
36
fields: ['_id']
38
-
}).then(function(res){
39
-
res.docs.sort(sortById);
40
-
res.docs.should.deep.equal([{_id: 'f'}]);
41
-
42
37
});
38
+
res.docs.sort(sortById);
39
+
res.docs.should.deep.equal([{_id: 'f'}]);
43
40
});
44
41
45
-
it('does number',function(){
46
-
vardb=context.db;
47
-
returndb.find({
42
+
it('does number',async()=>{
43
+
constdb=context.db;
44
+
constres=awaitdb.find({
48
45
selector: {
49
46
'foo': {$type: 'number'}
50
47
},
51
48
fields: ['_id']
52
-
}).then(function(res){
53
-
res.docs.sort(sortById);
54
-
res.docs.should.deep.equal([{_id: 'b'}]);
55
49
});
50
+
res.docs.sort(sortById);
51
+
res.docs.should.deep.equal([{_id: 'b'}]);
56
52
});
57
53
58
-
it('does string',function(){
59
-
vardb=context.db;
60
-
returndb.find({
54
+
it('does string',async()=>{
55
+
constdb=context.db;
56
+
constres=awaitdb.find({
61
57
selector: {
62
58
'foo': {$type: 'string'}
63
59
},
64
60
fields: ['_id']
65
-
}).then(function(res){
66
-
res.docs.sort(sortById);
67
-
res.docs.should.deep.equal([{_id: 'a'}]);
68
61
});
62
+
res.docs.sort(sortById);
63
+
res.docs.should.deep.equal([{_id: 'a'}]);
69
64
});
70
65
71
-
it('does array',function(){
72
-
vardb=context.db;
73
-
returndb.find({
66
+
it('does array',async()=>{
67
+
constdb=context.db;
68
+
constres=awaitdb.find({
74
69
selector: {
75
70
'foo': {$type: 'array'}
76
71
},
77
72
fields: ['_id']
78
-
}).then(function(res){
79
-
res.docs.sort(sortById);
80
-
res.docs.should.deep.equal([{_id: 'd'}]);
81
73
});
74
+
res.docs.sort(sortById);
75
+
res.docs.should.deep.equal([{_id: 'd'}]);
82
76
});
83
77
84
-
it('does object',function(){
85
-
vardb=context.db;
86
-
returndb.find({
78
+
it('does object',async()=>{
79
+
constdb=context.db;
80
+
constres=awaitdb.find({
87
81
selector: {
88
82
'foo': {$type: 'object'}
89
83
},
90
84
fields: ['_id']
91
-
}).then(function(res){
92
-
res.docs.sort(sortById);
93
-
res.docs.should.deep.equal([{_id: 'e'}]);
94
85
});
86
+
res.docs.sort(sortById);
87
+
res.docs.should.deep.equal([{_id: 'e'}]);
95
88
});
96
89
97
-
it('should error for unsupported query value',function(){
98
-
vardb=context.db;
99
-
returndb.find({
100
-
selector: {
101
-
'foo': {$type: 'made-up'}
102
-
},
103
-
fields: ['_id']
104
-
}).catch(function(err){
90
+
it('should error for unsupported query value',async()=>{
91
+
constdb=context.db;
92
+
try{
93
+
awaitdb.find({
94
+
selector: {
95
+
'foo': {$type: 'made-up'}
96
+
},
97
+
fields: ['_id']
98
+
});
99
+
thrownewError('Function should throw');
100
+
}catch(err){
105
101
err.message.should.eq('Query operator $type must be a string. Supported values: "null", "boolean", "number", "string", "array", or "object". Received string: made-up');
106
-
});
102
+
}
107
103
});
108
-
it('should error for non-string query value',function(){
109
-
vardb=context.db;
110
-
returndb.find({
111
-
selector: {
112
-
'foo': {$type: 0}
113
-
},
114
-
fields: ['_id']
115
-
}).then(function(){
104
+
105
+
it('should error for non-string query value',async()=>{
106
+
constdb=context.db;
107
+
try{
108
+
awaitdb.find({
109
+
selector: {
110
+
'foo': {$type: 0}
111
+
},
112
+
fields: ['_id']
113
+
});
116
114
thrownewError('Function should throw');
117
-
},function(err){
115
+
}catch(err){
118
116
err.message.should.eq('Query operator $type must be a string. Supported values: "null", "boolean", "number", "string", "array", or "object". Received number: 0');
0 commit comments