mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-17 05:10:31 +00:00
WIP Roles and permissions access control.
This commit is contained in:
15
server/tests/models/User.test.js
Normal file
15
server/tests/models/User.test.js
Normal file
@@ -0,0 +1,15 @@
|
||||
import { create, expect } from '~/testInit';
|
||||
import User from '@/models/User';
|
||||
import '@/models/Role';
|
||||
|
||||
describe('Model: User', () => {
|
||||
it('User model may has many associated roles.', async () => {
|
||||
const userHasRole = await create('user_has_role');
|
||||
await create('user_has_role', { user_id: userHasRole.user_id });
|
||||
|
||||
const userModel = await User.where('id', userHasRole.user_id).fetch();
|
||||
const userRoles = await userModel.roles().fetch();
|
||||
|
||||
expect(userRoles).to.have.lengthOf(2);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user