|
|
|
|
@ -35,6 +35,33 @@ describe('[Roles]', function() { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('GET [/roles.sync]', () => { |
|
|
|
|
it('should return an array of roles which are updated after updatedSice date when search by "updatedSince" query parameter', (done) => { |
|
|
|
|
request.get(api('roles.sync?updatedSince=2018-11-27T13:52:01Z')) |
|
|
|
|
.set(credentials) |
|
|
|
|
.expect('Content-Type', 'application/json') |
|
|
|
|
.expect(200) |
|
|
|
|
.expect((res) => { |
|
|
|
|
expect(res.body).to.have.property('success', true); |
|
|
|
|
expect(res.body).to.have.property('roles'); |
|
|
|
|
expect(res.body.roles).to.have.property('update').and.to.be.an('array'); |
|
|
|
|
expect(res.body.roles).to.have.property('remove').and.to.be.an('array'); |
|
|
|
|
}) |
|
|
|
|
.end(done); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('should return an error when updatedSince query parameter is not a valid ISODate string', (done) => { |
|
|
|
|
request.get(api('roles.sync?updatedSince=fsafdf')) |
|
|
|
|
.set(credentials) |
|
|
|
|
.expect('Content-Type', 'application/json') |
|
|
|
|
.expect(400) |
|
|
|
|
.expect((res) => { |
|
|
|
|
expect(res.body).to.have.property('success', false); |
|
|
|
|
}) |
|
|
|
|
.end(done); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
describe('POST [/roles.create]', () => { |
|
|
|
|
it('should create a new role with Users scope', (done) => { |
|
|
|
|
request.post(api('roles.create')) |
|
|
|
|
|