@@ -12,15 +12,41 @@ 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
+ } ) ;
25
+ } ) ;
26
+ } ) ;
27
+
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 ) ;
24
50
} ) ;
25
51
} ) ;
26
52
} ) ;
@@ -29,7 +55,15 @@ describe('ListCollectionsOperation', 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
+
62
+ context ( 'when authorizedCollections is not provided' , function ( ) {
63
+ const operation = new ListCollectionsOperation ( db , { } , { dbName : db } ) ;
64
+
65
+ it ( 'sets authorizedCollections to false' , function ( ) {
66
+ expect ( operation ) . to . have . property ( 'authorizedCollections' , false ) ;
33
67
} ) ;
34
68
} ) ;
35
69
} ) ;
@@ -44,7 +78,8 @@ describe('ListCollectionsOperation', function () {
44
78
listCollections : 1 ,
45
79
cursor : { } ,
46
80
filter : { } ,
47
- nameOnly : true
81
+ nameOnly : true ,
82
+ authorizedCollections : false
48
83
} ) ;
49
84
} ) ;
50
85
} ) ;
@@ -57,7 +92,46 @@ describe('ListCollectionsOperation', function () {
57
92
listCollections : 1 ,
58
93
cursor : { } ,
59
94
filter : { } ,
60
- nameOnly : false
95
+ nameOnly : false ,
96
+ authorizedCollections : false
97
+ } ) ;
98
+ } ) ;
99
+ } ) ;
100
+ } ) ;
101
+
102
+ context ( 'when authorizedCollections is provided' , function ( ) {
103
+ context ( 'when authorizedCollections is true' , function ( ) {
104
+ const operation = new ListCollectionsOperation (
105
+ db ,
106
+ { } ,
107
+ { authorizedCollections : true , dbName : db }
108
+ ) ;
109
+
110
+ it ( 'sets authorizedCollections to true' , function ( ) {
111
+ expect ( operation . generateCommand ( ) ) . to . deep . equal ( {
112
+ listCollections : 1 ,
113
+ cursor : { } ,
114
+ filter : { } ,
115
+ nameOnly : false ,
116
+ authorizedCollections : true
117
+ } ) ;
118
+ } ) ;
119
+ } ) ;
120
+
121
+ context ( 'when authorizedCollections is false' , function ( ) {
122
+ const operation = new ListCollectionsOperation (
123
+ db ,
124
+ { } ,
125
+ { authorizedCollections : false , dbName : db }
126
+ ) ;
127
+
128
+ it ( 'sets authorizedCollections to false' , function ( ) {
129
+ expect ( operation . generateCommand ( ) ) . to . deep . equal ( {
130
+ listCollections : 1 ,
131
+ cursor : { } ,
132
+ filter : { } ,
133
+ nameOnly : false ,
134
+ authorizedCollections : false
61
135
} ) ;
62
136
} ) ;
63
137
} ) ;
@@ -71,7 +145,22 @@ describe('ListCollectionsOperation', function () {
71
145
listCollections : 1 ,
72
146
cursor : { } ,
73
147
filter : { } ,
74
- nameOnly : false
148
+ nameOnly : false ,
149
+ authorizedCollections : false
150
+ } ) ;
151
+ } ) ;
152
+ } ) ;
153
+
154
+ context ( 'when authorizedCollections is not provided' , function ( ) {
155
+ const operation = new ListCollectionsOperation ( db , { } , { dbName : db } ) ;
156
+
157
+ it ( 'sets authorizedCollections to false' , function ( ) {
158
+ expect ( operation . generateCommand ( ) ) . to . deep . equal ( {
159
+ listCollections : 1 ,
160
+ cursor : { } ,
161
+ filter : { } ,
162
+ nameOnly : false ,
163
+ authorizedCollections : false
75
164
} ) ;
76
165
} ) ;
77
166
} ) ;
0 commit comments