mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Remove roleId indirection (no-changelog) (#8413)
This commit is contained in:
committed by
GitHub
parent
1affebd85e
commit
d6deceacde
41
packages/cli/test/integration/user.repository.test.ts
Normal file
41
packages/cli/test/integration/user.repository.test.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import Container from 'typedi';
|
||||
import { UserRepository } from '@db/repositories/user.repository';
|
||||
import { createAdmin, createMember, createOwner } from './shared/db/users';
|
||||
import * as testDb from './shared/testDb';
|
||||
|
||||
describe('UserRepository', () => {
|
||||
let userRepository: UserRepository;
|
||||
|
||||
beforeAll(async () => {
|
||||
await testDb.init();
|
||||
|
||||
userRepository = Container.get(UserRepository);
|
||||
|
||||
await testDb.truncate(['User']);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await testDb.terminate();
|
||||
});
|
||||
|
||||
describe('countUsersByRole()', () => {
|
||||
test('should return the number of users in each role', async () => {
|
||||
await Promise.all([
|
||||
createOwner(),
|
||||
createAdmin(),
|
||||
createAdmin(),
|
||||
createMember(),
|
||||
createMember(),
|
||||
createMember(),
|
||||
]);
|
||||
|
||||
const usersByRole = await userRepository.countUsersByRole();
|
||||
|
||||
expect(usersByRole).toStrictEqual({
|
||||
'global:admin': 2,
|
||||
'global:member': 3,
|
||||
'global:owner': 1,
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user