@@ -12,24 +12,54 @@ describe('ListCollectionsOperation', function () {
12
12
const operation = new ListCollectionsOperation ( db , { } , { nameOnly : true , dbName : db } ) ;
13
13
14
14
it ( 'sets nameOnly to true' , function ( ) {
15
- expect ( operation . nameOnly ) . to . be . true ;
15
+ expect ( operation ) . to . have . property ( 'nameOnly' , true ) ;
16
16
} ) ;
17
17
} ) ;
18
18
19
19
context ( 'when nameOnly is false' , function ( ) {
20
20
const operation = new ListCollectionsOperation ( db , { } , { nameOnly : false , dbName : db } ) ;
21
21
22
22
it ( 'sets nameOnly to false' , function ( ) {
23
- expect ( operation . nameOnly ) . to . be . false ;
23
+ expect ( operation ) . to . have . property ( 'nameOnly' , false ) ;
24
24
} ) ;
25
25
} ) ;
26
26
} ) ;
27
27
28
- context ( 'when nameOnly is not provided' , function ( ) {
28
+ context ( 'when authorizedCollections is provided' , function ( ) {
29
+ context ( 'when authorizedCollections is true' , function ( ) {
30
+ const operation = new ListCollectionsOperation (
31
+ db ,
32
+ { } ,
33
+ { authorizedCollections : true , dbName : db }
34
+ ) ;
35
+
36
+ it ( 'sets authorizedCollections to true' , function ( ) {
37
+ expect ( operation ) . to . have . property ( 'authorizedCollections' , true ) ;
38
+ } ) ;
39
+ } ) ;
40
+
41
+ context ( 'when authorizedCollections is false' , function ( ) {
42
+ const operation = new ListCollectionsOperation (
43
+ db ,
44
+ { } ,
45
+ { authorizedCollections : false , dbName : db }
46
+ ) ;
47
+
48
+ it ( 'sets authorizedCollections to false' , function ( ) {
49
+ expect ( operation ) . to . have . property ( 'authorizedCollections' , false ) ;
50
+ } ) ;
51
+ } ) ;
52
+ } ) ;
53
+
54
+ context ( 'when no options are provided' , function ( ) {
29
55
const operation = new ListCollectionsOperation ( db , { } , { dbName : db } ) ;
30
56
31
57
it ( 'sets nameOnly to false' , function ( ) {
32
- expect ( operation . nameOnly ) . to . be . false ;
58
+ expect ( operation ) . to . have . property ( 'nameOnly' , false ) ;
59
+ } ) ;
60
+
61
+ it ( 'sets authorizedCollections to false' , function ( ) {
62
+ expect ( operation ) . to . have . property ( 'authorizedCollections' , false ) ;
33
63
} ) ;
34
64
} ) ;
35
65
} ) ;
@@ -44,7 +74,8 @@ describe('ListCollectionsOperation', function () {
44
74
listCollections : 1 ,
45
75
cursor : { } ,
46
76
filter : { } ,
47
- nameOnly : true
77
+ nameOnly : true ,
78
+ authorizedCollections : false
48
79
} ) ;
49
80
} ) ;
50
81
} ) ;
@@ -57,21 +88,61 @@ describe('ListCollectionsOperation', function () {
57
88
listCollections : 1 ,
58
89
cursor : { } ,
59
90
filter : { } ,
60
- nameOnly : false
91
+ nameOnly : false ,
92
+ authorizedCollections : false
61
93
} ) ;
62
94
} ) ;
63
95
} ) ;
64
96
} ) ;
65
97
66
- context ( 'when nameOnly is not provided' , function ( ) {
98
+ context ( 'when authorizedCollections is provided' , function ( ) {
99
+ context ( 'when authorizedCollections is true' , function ( ) {
100
+ const operation = new ListCollectionsOperation (
101
+ db ,
102
+ { } ,
103
+ { authorizedCollections : true , dbName : db }
104
+ ) ;
105
+
106
+ it ( 'sets authorizedCollections to true' , function ( ) {
107
+ expect ( operation . generateCommand ( ) ) . to . deep . equal ( {
108
+ listCollections : 1 ,
109
+ cursor : { } ,
110
+ filter : { } ,
111
+ nameOnly : false ,
112
+ authorizedCollections : true
113
+ } ) ;
114
+ } ) ;
115
+ } ) ;
116
+
117
+ context ( 'when authorizedCollections is false' , function ( ) {
118
+ const operation = new ListCollectionsOperation (
119
+ db ,
120
+ { } ,
121
+ { authorizedCollections : false , dbName : db }
122
+ ) ;
123
+
124
+ it ( 'sets authorizedCollections to false' , function ( ) {
125
+ expect ( operation . generateCommand ( ) ) . to . deep . equal ( {
126
+ listCollections : 1 ,
127
+ cursor : { } ,
128
+ filter : { } ,
129
+ nameOnly : false ,
130
+ authorizedCollections : false
131
+ } ) ;
132
+ } ) ;
133
+ } ) ;
134
+ } ) ;
135
+
136
+ context ( 'when no options are provided' , function ( ) {
67
137
const operation = new ListCollectionsOperation ( db , { } , { dbName : db } ) ;
68
138
69
- it ( 'sets nameOnly to false' , function ( ) {
139
+ it ( 'sets nameOnly and authorizedCollections properties to false' , function ( ) {
70
140
expect ( operation . generateCommand ( ) ) . to . deep . equal ( {
71
141
listCollections : 1 ,
72
142
cursor : { } ,
73
143
filter : { } ,
74
- nameOnly : false
144
+ nameOnly : false ,
145
+ authorizedCollections : false
75
146
} ) ;
76
147
} ) ;
77
148
} ) ;
0 commit comments