@@ -98,10 +98,10 @@ describe('Parse Role testing', () => {
98
98
var user ,
99
99
auth ,
100
100
getAllRolesSpy ;
101
- createTestUser ( ) . then ( ( newUser ) => {
101
+ createTestUser ( ) . then ( ( newUser ) => {
102
102
user = newUser ;
103
103
return createAllRoles ( user ) ;
104
- } ) . then ( ( roles ) => {
104
+ } ) . then ( ( roles ) => {
105
105
var rootRoleObj = roleObjs [ rootRole ] ;
106
106
roles . forEach ( function ( role , i ) {
107
107
// Add all roles to the RootRole
@@ -115,12 +115,12 @@ describe('Parse Role testing', () => {
115
115
} ) ;
116
116
117
117
return Parse . Object . saveAll ( roles , { useMasterKey : true } ) ;
118
- } ) . then ( ( ) => {
118
+ } ) . then ( ( ) => {
119
119
auth = new Auth ( { config : new Config ( "test" ) , isMaster : true , user : user } ) ;
120
120
getAllRolesSpy = spyOn ( auth , "_getAllRolesNamesForRoleIds" ) . and . callThrough ( ) ;
121
121
122
122
return auth . _loadRoles ( ) ;
123
- } ) . then ( ( roles ) => {
123
+ } ) . then ( ( roles ) => {
124
124
expect ( roles . length ) . toEqual ( 4 ) ;
125
125
126
126
allRoles . forEach ( function ( name ) {
@@ -135,7 +135,7 @@ describe('Parse Role testing', () => {
135
135
// 1 call for the 2nd layer
136
136
expect ( getAllRolesSpy . calls . count ( ) ) . toEqual ( 2 ) ;
137
137
done ( )
138
- } ) . catch ( ( ) => {
138
+ } ) . catch ( ( ) => {
139
139
fail ( "should succeed" ) ;
140
140
done ( ) ;
141
141
} ) ;
@@ -145,26 +145,26 @@ describe('Parse Role testing', () => {
145
145
it ( "should recursively load roles" , ( done ) => {
146
146
var rolesNames = [ "FooRole" , "BarRole" , "BazRole" ] ;
147
147
var roleIds = { } ;
148
- createTestUser ( ) . then ( ( user ) => {
148
+ createTestUser ( ) . then ( ( user ) => {
149
149
// Put the user on the 1st role
150
- return createRole ( rolesNames [ 0 ] , null , user ) . then ( ( aRole ) => {
150
+ return createRole ( rolesNames [ 0 ] , null , user ) . then ( ( aRole ) => {
151
151
roleIds [ aRole . get ( "name" ) ] = aRole . id ;
152
152
// set the 1st role as a sibling of the second
153
153
// user will should have 2 role now
154
154
return createRole ( rolesNames [ 1 ] , aRole , null ) ;
155
- } ) . then ( ( anotherRole ) => {
155
+ } ) . then ( ( anotherRole ) => {
156
156
roleIds [ anotherRole . get ( "name" ) ] = anotherRole . id ;
157
157
// set this role as a sibling of the last
158
158
// the user should now have 3 roles
159
159
return createRole ( rolesNames [ 2 ] , anotherRole , null ) ;
160
- } ) . then ( ( lastRole ) => {
160
+ } ) . then ( ( lastRole ) => {
161
161
roleIds [ lastRole . get ( "name" ) ] = lastRole . id ;
162
162
var auth = new Auth ( { config : new Config ( "test" ) , isMaster : true , user : user } ) ;
163
163
return auth . _loadRoles ( ) ;
164
164
} )
165
- } ) . then ( ( roles ) => {
165
+ } ) . then ( ( roles ) => {
166
166
expect ( roles . length ) . toEqual ( 3 ) ;
167
- rolesNames . forEach ( ( name ) => {
167
+ rolesNames . forEach ( ( name ) => {
168
168
expect ( roles . indexOf ( 'role:' + name ) ) . not . toBe ( - 1 ) ;
169
169
} ) ;
170
170
done ( ) ;
0 commit comments