@hedhog/admin 0.0.38 → 0.0.40
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/auth/auth.service.spec.d.ts +2 -0
- package/dist/auth/auth.service.spec.d.ts.map +1 -0
- package/dist/auth/auth.service.spec.js +163 -0
- package/dist/auth/auth.service.spec.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/locale/locale.module.js +2 -2
- package/dist/locale/locale.module.js.map +1 -1
- package/dist/locale/locale.service.js +1 -1
- package/dist/locale/locale.service.js.map +1 -1
- package/dist/locale/locale.service.spec.d.ts +2 -0
- package/dist/locale/locale.service.spec.d.ts.map +1 -0
- package/dist/locale/locale.service.spec.js +171 -0
- package/dist/locale/locale.service.spec.js.map +1 -0
- package/dist/menu/menu.service.spec.d.ts +2 -0
- package/dist/menu/menu.service.spec.d.ts.map +1 -0
- package/dist/menu/menu.service.spec.js +196 -0
- package/dist/menu/menu.service.spec.js.map +1 -0
- package/dist/role/role.service.spec.d.ts +2 -0
- package/dist/role/role.service.spec.d.ts.map +1 -0
- package/dist/role/role.service.spec.js +343 -0
- package/dist/role/role.service.spec.js.map +1 -0
- package/dist/route/route.service.spec.d.ts +2 -0
- package/dist/route/route.service.spec.d.ts.map +1 -0
- package/dist/route/route.service.spec.js +235 -0
- package/dist/route/route.service.spec.js.map +1 -0
- package/dist/screen/screen.service.spec.d.ts +2 -0
- package/dist/screen/screen.service.spec.d.ts.map +1 -0
- package/dist/screen/screen.service.spec.js +242 -0
- package/dist/screen/screen.service.spec.js.map +1 -0
- package/dist/setting/settings.service.spec.d.ts +2 -0
- package/dist/setting/settings.service.spec.d.ts.map +1 -0
- package/dist/setting/settings.service.spec.js +147 -0
- package/dist/setting/settings.service.spec.js.map +1 -0
- package/dist/user/user.service.spec.d.ts +2 -0
- package/dist/user/user.service.spec.d.ts.map +1 -0
- package/dist/user/user.service.spec.js +239 -0
- package/dist/user/user.service.spec.js.map +1 -0
- package/package.json +1 -1
- package/src/migrations/migrate-01.ts +1 -6
- package/src/migrations/migrate-02.ts +137 -137
@@ -0,0 +1,196 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
4
|
+
const menu_service_1 = require("./menu.service");
|
5
|
+
const prisma_1 = require("@hedhog/prisma");
|
6
|
+
const pagination_1 = require("@hedhog/pagination");
|
7
|
+
const common_1 = require("@nestjs/common");
|
8
|
+
describe('MenuService', () => {
|
9
|
+
let menuService;
|
10
|
+
let prismaService;
|
11
|
+
let paginationService;
|
12
|
+
const mockPrismaService = {
|
13
|
+
menus: {
|
14
|
+
create: jest.fn(),
|
15
|
+
update: jest.fn(),
|
16
|
+
deleteMany: jest.fn(),
|
17
|
+
findUnique: jest.fn(),
|
18
|
+
findMany: jest.fn(),
|
19
|
+
count: jest.fn(),
|
20
|
+
},
|
21
|
+
role_menus: {
|
22
|
+
deleteMany: jest.fn(),
|
23
|
+
createMany: jest.fn(),
|
24
|
+
},
|
25
|
+
menu_screens: {
|
26
|
+
deleteMany: jest.fn(),
|
27
|
+
createMany: jest.fn(),
|
28
|
+
},
|
29
|
+
};
|
30
|
+
const mockPaginationService = {
|
31
|
+
paginate: jest.fn(),
|
32
|
+
createInsensitiveSearch: jest.fn(),
|
33
|
+
};
|
34
|
+
beforeEach(async () => {
|
35
|
+
const module = await testing_1.Test.createTestingModule({
|
36
|
+
providers: [
|
37
|
+
menu_service_1.MenuService,
|
38
|
+
{ provide: prisma_1.PrismaService, useValue: mockPrismaService },
|
39
|
+
{ provide: pagination_1.PaginationService, useValue: mockPaginationService },
|
40
|
+
],
|
41
|
+
}).compile();
|
42
|
+
menuService = module.get(menu_service_1.MenuService);
|
43
|
+
prismaService = module.get(prisma_1.PrismaService);
|
44
|
+
paginationService = module.get(pagination_1.PaginationService);
|
45
|
+
});
|
46
|
+
afterEach(() => {
|
47
|
+
jest.clearAllMocks();
|
48
|
+
});
|
49
|
+
describe('create', () => {
|
50
|
+
it('should create a new menu', async () => {
|
51
|
+
const createMenuDto = {
|
52
|
+
name: 'Test Menu',
|
53
|
+
url: '/test',
|
54
|
+
icon: 'test-icon',
|
55
|
+
order: 1,
|
56
|
+
menu_id: undefined,
|
57
|
+
};
|
58
|
+
mockPrismaService.menus.create.mockResolvedValue(createMenuDto);
|
59
|
+
const result = await menuService.create(createMenuDto);
|
60
|
+
expect(result).toEqual(createMenuDto);
|
61
|
+
expect(prismaService.menus.create).toHaveBeenCalledWith({
|
62
|
+
data: createMenuDto,
|
63
|
+
});
|
64
|
+
});
|
65
|
+
});
|
66
|
+
describe('update', () => {
|
67
|
+
it('should update a menu', async () => {
|
68
|
+
const updateDto = { id: 1, data: { name: 'Updated Menu' } };
|
69
|
+
mockPrismaService.menus.update.mockResolvedValue(updateDto.data);
|
70
|
+
const result = await menuService.update(updateDto);
|
71
|
+
expect(result).toEqual(updateDto.data);
|
72
|
+
expect(prismaService.menus.update).toHaveBeenCalledWith({
|
73
|
+
where: { id: updateDto.id },
|
74
|
+
data: updateDto.data,
|
75
|
+
});
|
76
|
+
});
|
77
|
+
});
|
78
|
+
describe('delete', () => {
|
79
|
+
it('should delete menus', async () => {
|
80
|
+
const deleteDto = { ids: [1, 2, 3] };
|
81
|
+
mockPrismaService.menus.deleteMany.mockResolvedValue({ count: 3 });
|
82
|
+
const result = await menuService.delete(deleteDto);
|
83
|
+
expect(result).toEqual({ count: 3 });
|
84
|
+
expect(prismaService.menus.deleteMany).toHaveBeenCalledWith({
|
85
|
+
where: { id: { in: deleteDto.ids } },
|
86
|
+
});
|
87
|
+
});
|
88
|
+
it('should throw BadRequestException if no ids are provided', async () => {
|
89
|
+
await expect(menuService.delete({ ids: null })).rejects.toThrow(common_1.BadRequestException);
|
90
|
+
});
|
91
|
+
});
|
92
|
+
describe('listScreens', () => {
|
93
|
+
it('should paginate screens', async () => {
|
94
|
+
const locale = 'en';
|
95
|
+
const menuId = 1;
|
96
|
+
const paginationParams = {
|
97
|
+
page: 1,
|
98
|
+
pageSize: 10,
|
99
|
+
search: '',
|
100
|
+
sortField: '',
|
101
|
+
sortOrder: pagination_1.PageOrderDirection.Asc,
|
102
|
+
fields: '',
|
103
|
+
};
|
104
|
+
const mockScreens = [{ id: 1, name: 'Screen 1' }];
|
105
|
+
mockPaginationService.paginate.mockResolvedValue(mockScreens);
|
106
|
+
const result = await menuService.listScreens(locale, menuId, paginationParams);
|
107
|
+
expect(result).toEqual(mockScreens);
|
108
|
+
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.screens, paginationParams, expect.anything(), 'screen_translations');
|
109
|
+
});
|
110
|
+
});
|
111
|
+
describe('updateScreens', () => {
|
112
|
+
it('should update screens associated with a menu', async () => {
|
113
|
+
const menuId = 1;
|
114
|
+
const updateData = { ids: [1, 2, 3] };
|
115
|
+
jest
|
116
|
+
.spyOn(prismaService.menu_screens, 'deleteMany')
|
117
|
+
.mockResolvedValue(null);
|
118
|
+
jest
|
119
|
+
.spyOn(prismaService.menu_screens, 'createMany')
|
120
|
+
.mockResolvedValue(null);
|
121
|
+
await menuService.updateScreens(menuId, updateData);
|
122
|
+
expect(prismaService.menu_screens.deleteMany).toHaveBeenCalledWith({
|
123
|
+
where: { menu_id: menuId },
|
124
|
+
});
|
125
|
+
expect(prismaService.menu_screens.createMany).toHaveBeenCalledWith({
|
126
|
+
data: updateData.ids.map((screenId) => ({
|
127
|
+
menu_id: menuId,
|
128
|
+
screen_id: screenId,
|
129
|
+
})),
|
130
|
+
skipDuplicates: true,
|
131
|
+
});
|
132
|
+
});
|
133
|
+
});
|
134
|
+
describe('updateRoles', () => {
|
135
|
+
it('should update roles associated with a menu', async () => {
|
136
|
+
const menuId = 1;
|
137
|
+
const updateData = { ids: [1, 2] };
|
138
|
+
jest
|
139
|
+
.spyOn(prismaService.role_menus, 'deleteMany')
|
140
|
+
.mockResolvedValue(null);
|
141
|
+
jest
|
142
|
+
.spyOn(prismaService.role_menus, 'createMany')
|
143
|
+
.mockResolvedValue(null);
|
144
|
+
await menuService.updateRoles(menuId, updateData);
|
145
|
+
expect(prismaService.role_menus.deleteMany).toHaveBeenCalledWith({
|
146
|
+
where: { menu_id: menuId },
|
147
|
+
});
|
148
|
+
expect(prismaService.role_menus.createMany).toHaveBeenCalledWith({
|
149
|
+
data: updateData.ids.map((roleId) => ({
|
150
|
+
menu_id: menuId,
|
151
|
+
role_id: roleId,
|
152
|
+
})),
|
153
|
+
skipDuplicates: true,
|
154
|
+
});
|
155
|
+
});
|
156
|
+
});
|
157
|
+
describe('updateOrder', () => {
|
158
|
+
it('should update the order of menus', async () => {
|
159
|
+
const orderData = { ids: [1, 2, 3] };
|
160
|
+
jest.spyOn(prismaService.menus, 'count').mockResolvedValue(3);
|
161
|
+
jest.spyOn(prismaService.menus, 'update').mockResolvedValue(null);
|
162
|
+
await menuService.updateOrder(orderData);
|
163
|
+
expect(prismaService.menus.count).toHaveBeenCalledWith({
|
164
|
+
where: { id: { in: orderData.ids } },
|
165
|
+
});
|
166
|
+
expect(prismaService.menus.update).toHaveBeenCalledTimes(orderData.ids.length);
|
167
|
+
orderData.ids.forEach((id, index) => {
|
168
|
+
expect(prismaService.menus.update).toHaveBeenCalledWith({
|
169
|
+
where: { id },
|
170
|
+
data: { order: index + 1 },
|
171
|
+
});
|
172
|
+
});
|
173
|
+
});
|
174
|
+
it('should throw BadRequestException if IDs are invalid', async () => {
|
175
|
+
const orderData = { ids: [1, 2, 3] };
|
176
|
+
jest.spyOn(prismaService.menus, 'count').mockResolvedValue(2); // IDs não batem com o número esperado
|
177
|
+
await expect(menuService.updateOrder(orderData)).rejects.toThrow(common_1.BadRequestException);
|
178
|
+
});
|
179
|
+
});
|
180
|
+
/*
|
181
|
+
describe('getMenus', () => {
|
182
|
+
it('should get menus for a user', async () => {
|
183
|
+
const locale = 'en';
|
184
|
+
const userId = 1;
|
185
|
+
const mockMenus = [{ id: 1, name: 'Menu 1' }];
|
186
|
+
mockPrismaService.menus.findMany.mockResolvedValue(mockMenus);
|
187
|
+
|
188
|
+
const result = await menuService.getMenus(locale, userId);
|
189
|
+
|
190
|
+
expect(result).toEqual(mockMenus);
|
191
|
+
expect(prismaService.menus.findMany).toHaveBeenCalled();
|
192
|
+
});
|
193
|
+
});
|
194
|
+
*/
|
195
|
+
});
|
196
|
+
//# sourceMappingURL=menu.service.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"menu.service.spec.js","sourceRoot":"","sources":["../../src/menu/menu.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,iDAA6C;AAC7C,2CAA+C;AAC/C,mDAI4B;AAC5B,2CAAqD;AAErD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,WAAwB,CAAC;IAC7B,IAAI,aAA4B,CAAC;IACjC,IAAI,iBAAoC,CAAC;IAEzC,MAAM,iBAAiB,GAAG;QACxB,KAAK,EAAE;YACL,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;YACjB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;YACjB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;YACrB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;YACrB,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;YACnB,KAAK,EAAE,IAAI,CAAC,EAAE,EAAE;SACjB;QACD,UAAU,EAAE;YACV,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;YACrB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;SACtB;QACD,YAAY,EAAE;YACZ,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;YACrB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;SACtB;KACF,CAAC;IAEF,MAAM,qBAAqB,GAAG;QAC5B,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;QACnB,uBAAuB,EAAE,IAAI,CAAC,EAAE,EAAE;KACnC,CAAC;IAEF,UAAU,CAAC,KAAK,IA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AAC,oBAAoB,CAAC;gBACrD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,SAAS,CAAC,GAAG,EAAE,EAAE;aACrC,CAAC,CAAC;YAEH,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,qBAAqB,CACtD,SAAS,CAAC,GAAG,CAAC,MAAM,CACrB,CAAC;YAEF,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE;gBAClC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC;oBACtD,KAAK,EAAE,EAAE,EAAE,EAAE;oBACb,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE;iBAC3B,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;YACnE,MAAM,SAAS,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;YAErC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,sCAAsC;YAErG,MAAM,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAC9D,4BAAmB,CACpB,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IACH;;;;;;;;;;;;;;MAcE;AACJ,CAAC,CAAC,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"role.service.spec.d.ts","sourceRoot":"","sources":["../../src/role/role.service.spec.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,343 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const testing_1 = require("@nestjs/testing");
|
4
|
+
const role_service_1 = require("./role.service");
|
5
|
+
const prisma_1 = require("@hedhog/prisma");
|
6
|
+
const pagination_1 = require("@hedhog/pagination");
|
7
|
+
const common_1 = require("@nestjs/common");
|
8
|
+
describe('RoleService', () => {
|
9
|
+
let roleService;
|
10
|
+
let prismaService;
|
11
|
+
let paginationService;
|
12
|
+
beforeEach(async () => {
|
13
|
+
const module = await testing_1.Test.createTestingModule({
|
14
|
+
providers: [
|
15
|
+
role_service_1.RoleService,
|
16
|
+
{
|
17
|
+
provide: prisma_1.PrismaService,
|
18
|
+
useValue: {
|
19
|
+
roles: {
|
20
|
+
create: jest.fn(),
|
21
|
+
update: jest.fn(),
|
22
|
+
findUnique: jest.fn(),
|
23
|
+
deleteMany: jest.fn(),
|
24
|
+
findMany: jest.fn(),
|
25
|
+
},
|
26
|
+
role_users: {
|
27
|
+
deleteMany: jest.fn(),
|
28
|
+
createMany: jest.fn(),
|
29
|
+
},
|
30
|
+
role_menus: {
|
31
|
+
deleteMany: jest.fn(),
|
32
|
+
createMany: jest.fn(),
|
33
|
+
},
|
34
|
+
role_screens: {
|
35
|
+
deleteMany: jest.fn(),
|
36
|
+
createMany: jest.fn(),
|
37
|
+
},
|
38
|
+
role_routes: {
|
39
|
+
deleteMany: jest.fn(),
|
40
|
+
createMany: jest.fn(),
|
41
|
+
},
|
42
|
+
},
|
43
|
+
},
|
44
|
+
{
|
45
|
+
provide: pagination_1.PaginationService,
|
46
|
+
useValue: {
|
47
|
+
paginate: jest.fn(),
|
48
|
+
},
|
49
|
+
},
|
50
|
+
],
|
51
|
+
}).compile();
|
52
|
+
roleService = module.get(role_service_1.RoleService);
|
53
|
+
prismaService = module.get(prisma_1.PrismaService);
|
54
|
+
paginationService = module.get(pagination_1.PaginationService);
|
55
|
+
});
|
56
|
+
describe('create', () => {
|
57
|
+
it('should create a new role', async () => {
|
58
|
+
const dto = {
|
59
|
+
name: 'Admin',
|
60
|
+
description: 'Administrator role',
|
61
|
+
};
|
62
|
+
const result = Object.assign(Object.assign({ id: 1 }, dto), { created_at: new Date(), updated_at: new Date() });
|
63
|
+
jest.spyOn(prismaService.roles, 'create').mockResolvedValue(result);
|
64
|
+
expect(await roleService.create(dto)).toEqual(result);
|
65
|
+
});
|
66
|
+
});
|
67
|
+
describe('update', () => {
|
68
|
+
it('should update an existing role', async () => {
|
69
|
+
const dto = {
|
70
|
+
name: 'Admin',
|
71
|
+
description: 'Updated description',
|
72
|
+
};
|
73
|
+
const result = Object.assign(Object.assign({ id: 1 }, dto), { created_at: new Date(), updated_at: new Date() });
|
74
|
+
jest.spyOn(prismaService.roles, 'update').mockResolvedValue(result);
|
75
|
+
expect(await roleService.update({ id: 1, data: dto })).toEqual(result);
|
76
|
+
});
|
77
|
+
});
|
78
|
+
describe('delete', () => {
|
79
|
+
it('should delete roles', async () => {
|
80
|
+
const dto = { ids: [1, 2] };
|
81
|
+
jest
|
82
|
+
.spyOn(prismaService.roles, 'deleteMany')
|
83
|
+
.mockResolvedValue({ count: 2 });
|
84
|
+
await roleService.delete(dto);
|
85
|
+
expect(prismaService.roles.deleteMany).toHaveBeenCalledWith({
|
86
|
+
where: {
|
87
|
+
id: { in: dto.ids },
|
88
|
+
},
|
89
|
+
});
|
90
|
+
});
|
91
|
+
it('should throw BadRequestException if no ids are provided', async () => {
|
92
|
+
const dto = { ids: null };
|
93
|
+
await expect(roleService.delete(dto)).rejects.toThrow(common_1.BadRequestException);
|
94
|
+
});
|
95
|
+
});
|
96
|
+
describe('updateUsers', () => {
|
97
|
+
it('should update users for a role', async () => {
|
98
|
+
const roleId = 1;
|
99
|
+
const data = { ids: [1, 2] };
|
100
|
+
jest
|
101
|
+
.spyOn(prismaService.role_users, 'deleteMany')
|
102
|
+
.mockResolvedValue({ count: 2 });
|
103
|
+
jest
|
104
|
+
.spyOn(prismaService.role_users, 'createMany')
|
105
|
+
.mockResolvedValue({ count: 2 });
|
106
|
+
await roleService.updateUsers(roleId, data);
|
107
|
+
expect(prismaService.role_users.deleteMany).toHaveBeenCalledWith({
|
108
|
+
where: { role_id: roleId },
|
109
|
+
});
|
110
|
+
expect(prismaService.role_users.createMany).toHaveBeenCalledWith({
|
111
|
+
data: data.ids.map((userId) => ({
|
112
|
+
role_id: roleId,
|
113
|
+
user_id: userId,
|
114
|
+
})),
|
115
|
+
skipDuplicates: true,
|
116
|
+
});
|
117
|
+
});
|
118
|
+
});
|
119
|
+
describe('updateScreens', () => {
|
120
|
+
it('should update screens for a role', async () => {
|
121
|
+
const roleId = 1;
|
122
|
+
const data = { ids: [1, 2] };
|
123
|
+
jest
|
124
|
+
.spyOn(prismaService.role_screens, 'deleteMany')
|
125
|
+
.mockResolvedValue({ count: 2 });
|
126
|
+
jest
|
127
|
+
.spyOn(prismaService.role_screens, 'createMany')
|
128
|
+
.mockResolvedValue({ count: 2 });
|
129
|
+
await roleService.updateScreens(roleId, data);
|
130
|
+
expect(prismaService.role_screens.deleteMany).toHaveBeenCalledWith({
|
131
|
+
where: { role_id: roleId },
|
132
|
+
});
|
133
|
+
expect(prismaService.role_screens.createMany).toHaveBeenCalledWith({
|
134
|
+
data: data.ids.map((screenId) => ({
|
135
|
+
role_id: roleId,
|
136
|
+
screen_id: screenId,
|
137
|
+
})),
|
138
|
+
skipDuplicates: true,
|
139
|
+
});
|
140
|
+
});
|
141
|
+
});
|
142
|
+
describe('updateRoutes', () => {
|
143
|
+
it('should update routes for a role', async () => {
|
144
|
+
const roleId = 1;
|
145
|
+
const data = { ids: [1, 2] };
|
146
|
+
jest
|
147
|
+
.spyOn(prismaService.role_routes, 'deleteMany')
|
148
|
+
.mockResolvedValue({ count: 2 });
|
149
|
+
jest
|
150
|
+
.spyOn(prismaService.role_routes, 'createMany')
|
151
|
+
.mockResolvedValue({ count: 2 });
|
152
|
+
await roleService.updateRoutes(roleId, data);
|
153
|
+
expect(prismaService.role_routes.deleteMany).toHaveBeenCalledWith({
|
154
|
+
where: { role_id: roleId },
|
155
|
+
});
|
156
|
+
expect(prismaService.role_routes.createMany).toHaveBeenCalledWith({
|
157
|
+
data: data.ids.map((routeId) => ({
|
158
|
+
role_id: roleId,
|
159
|
+
route_id: routeId,
|
160
|
+
})),
|
161
|
+
skipDuplicates: true,
|
162
|
+
});
|
163
|
+
});
|
164
|
+
});
|
165
|
+
describe('updateMenus', () => {
|
166
|
+
it('should update menus for a role', async () => {
|
167
|
+
const roleId = 1;
|
168
|
+
const data = { ids: [1, 2] };
|
169
|
+
jest
|
170
|
+
.spyOn(prismaService.role_menus, 'deleteMany')
|
171
|
+
.mockResolvedValue({ count: 2 });
|
172
|
+
jest
|
173
|
+
.spyOn(prismaService.role_menus, 'createMany')
|
174
|
+
.mockResolvedValue({ count: 2 });
|
175
|
+
await roleService.updateMenus(roleId, data);
|
176
|
+
expect(prismaService.role_menus.deleteMany).toHaveBeenCalledWith({
|
177
|
+
where: { role_id: roleId },
|
178
|
+
});
|
179
|
+
expect(prismaService.role_menus.createMany).toHaveBeenCalledWith({
|
180
|
+
data: data.ids.map((menuId) => ({
|
181
|
+
role_id: roleId,
|
182
|
+
menu_id: menuId,
|
183
|
+
})),
|
184
|
+
skipDuplicates: true,
|
185
|
+
});
|
186
|
+
});
|
187
|
+
});
|
188
|
+
describe('listUsers', () => {
|
189
|
+
it('should list users associated with a role', async () => {
|
190
|
+
const roleId = 1;
|
191
|
+
const paginationParams = {
|
192
|
+
page: 1,
|
193
|
+
pageSize: 10,
|
194
|
+
search: '',
|
195
|
+
sortField: '',
|
196
|
+
sortOrder: pagination_1.PageOrderDirection.Asc,
|
197
|
+
fields: '',
|
198
|
+
};
|
199
|
+
const mockPaginationResult = {
|
200
|
+
data: [],
|
201
|
+
total: 10,
|
202
|
+
lastPage: 1,
|
203
|
+
page: 1,
|
204
|
+
prev: 0,
|
205
|
+
next: 2,
|
206
|
+
pageSize: 10,
|
207
|
+
};
|
208
|
+
jest
|
209
|
+
.spyOn(paginationService, 'paginate')
|
210
|
+
.mockResolvedValue(mockPaginationResult);
|
211
|
+
await roleService.listUsers(roleId, paginationParams);
|
212
|
+
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.users, paginationParams, {
|
213
|
+
include: {
|
214
|
+
role_users: {
|
215
|
+
where: { role_id: roleId },
|
216
|
+
select: { user_id: true, role_id: true },
|
217
|
+
},
|
218
|
+
},
|
219
|
+
});
|
220
|
+
});
|
221
|
+
});
|
222
|
+
describe('listMenus', () => {
|
223
|
+
it('should list menus associated with a role', async () => {
|
224
|
+
const locale = 'en';
|
225
|
+
const roleId = 1;
|
226
|
+
const paginationParams = {
|
227
|
+
page: 1,
|
228
|
+
pageSize: 10,
|
229
|
+
search: '',
|
230
|
+
sortField: '',
|
231
|
+
sortOrder: pagination_1.PageOrderDirection.Asc,
|
232
|
+
fields: '',
|
233
|
+
};
|
234
|
+
const mockPaginationResult = {
|
235
|
+
data: [],
|
236
|
+
total: 10,
|
237
|
+
lastPage: 1,
|
238
|
+
page: 1,
|
239
|
+
prev: 0,
|
240
|
+
next: 2,
|
241
|
+
pageSize: 10,
|
242
|
+
};
|
243
|
+
jest
|
244
|
+
.spyOn(paginationService, 'paginate')
|
245
|
+
.mockResolvedValue(mockPaginationResult);
|
246
|
+
await roleService.listMenus(locale, roleId, paginationParams);
|
247
|
+
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.menus, paginationParams, {
|
248
|
+
include: {
|
249
|
+
menu_translations: {
|
250
|
+
where: { locales: { code: locale } },
|
251
|
+
select: { name: true },
|
252
|
+
},
|
253
|
+
role_menus: {
|
254
|
+
where: { role_id: roleId },
|
255
|
+
select: { menu_id: true, role_id: true },
|
256
|
+
},
|
257
|
+
},
|
258
|
+
}, 'menu_translations');
|
259
|
+
});
|
260
|
+
});
|
261
|
+
describe('listRoutes', () => {
|
262
|
+
it('should list routes associated with a role', async () => {
|
263
|
+
const roleId = 1;
|
264
|
+
const paginationParams = {
|
265
|
+
page: 1,
|
266
|
+
pageSize: 10,
|
267
|
+
search: '',
|
268
|
+
sortField: '',
|
269
|
+
sortOrder: pagination_1.PageOrderDirection.Asc,
|
270
|
+
fields: '',
|
271
|
+
};
|
272
|
+
const mockPaginationResult = {
|
273
|
+
data: [],
|
274
|
+
total: 10,
|
275
|
+
lastPage: 1,
|
276
|
+
page: 1,
|
277
|
+
prev: 0,
|
278
|
+
next: 2,
|
279
|
+
pageSize: 10,
|
280
|
+
};
|
281
|
+
jest
|
282
|
+
.spyOn(paginationService, 'paginate')
|
283
|
+
.mockResolvedValue(mockPaginationResult);
|
284
|
+
await roleService.listRoutes(roleId, paginationParams);
|
285
|
+
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.routes, paginationParams, {
|
286
|
+
include: {
|
287
|
+
role_routes: {
|
288
|
+
where: { role_id: roleId },
|
289
|
+
select: { route_id: true, role_id: true },
|
290
|
+
},
|
291
|
+
},
|
292
|
+
});
|
293
|
+
});
|
294
|
+
});
|
295
|
+
describe('listScreens', () => {
|
296
|
+
it('should list screens associated with a role', async () => {
|
297
|
+
const locale = 'en';
|
298
|
+
const roleId = 1;
|
299
|
+
const paginationParams = {
|
300
|
+
page: 1,
|
301
|
+
pageSize: 10,
|
302
|
+
search: '',
|
303
|
+
sortField: '',
|
304
|
+
sortOrder: pagination_1.PageOrderDirection.Asc,
|
305
|
+
fields: '',
|
306
|
+
};
|
307
|
+
const mockPaginationResult = {
|
308
|
+
data: [],
|
309
|
+
total: 10,
|
310
|
+
lastPage: 1,
|
311
|
+
page: 1,
|
312
|
+
prev: 0,
|
313
|
+
next: 2,
|
314
|
+
pageSize: 10,
|
315
|
+
};
|
316
|
+
jest
|
317
|
+
.spyOn(paginationService, 'paginate')
|
318
|
+
.mockResolvedValue(mockPaginationResult);
|
319
|
+
await roleService.listScreens(locale, roleId, paginationParams);
|
320
|
+
expect(paginationService.paginate).toHaveBeenCalledWith(prismaService.screens, paginationParams, {
|
321
|
+
include: {
|
322
|
+
screen_translations: {
|
323
|
+
where: { locales: { code: locale } },
|
324
|
+
select: { name: true },
|
325
|
+
},
|
326
|
+
role_screens: {
|
327
|
+
where: { role_id: roleId },
|
328
|
+
select: { screen_id: true, role_id: true },
|
329
|
+
},
|
330
|
+
},
|
331
|
+
}, 'screen_translations');
|
332
|
+
});
|
333
|
+
});
|
334
|
+
describe('get', () => {
|
335
|
+
it('should get a specific role by ID', async () => {
|
336
|
+
const roleId = 1;
|
337
|
+
const result = { id: roleId, name: 'Admin', description: 'Admin role' };
|
338
|
+
jest.spyOn(prismaService.roles, 'findUnique').mockResolvedValue(result);
|
339
|
+
expect(await roleService.get(roleId)).toEqual(result);
|
340
|
+
});
|
341
|
+
});
|
342
|
+
});
|
343
|
+
//# sourceMappingURL=role.service.spec.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"role.service.spec.js","sourceRoot":"","sources":["../../src/role/role.service.spec.ts"],"names":[],"mappings":";;AAAA,6CAAsD;AACtD,iDAA6C;AAC7C,2CAA+C;AAC/C,mDAI4B;AAC5B,2CAAqD;AAMrD,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,WAAwB,CAAC;IAC7B,IAAI,aAA4B,CAAC;IACjC,IAAI,iBAAoC,CAAC;IAEzC,UAAU,CAAC,KAAK,IAAI,EAAE;QACpB,MAAM,MAAM,GAAkB,MAAM,cAAI,CAAC,mBAAmB,CAAC;YAC3D,SAAS,EAAE;gBACT,0BAAW;gBACX;oBACE,OAAO,EAAE,sBAAa;oBACtB,QAAQ,EAAE;wBACR,KAAK,EAAE;4BACL,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;4BACjB,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE;4BACjB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;4BACrB,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;4BACrB,QAAQ,EAAE,IAAI,CAAC,EAAE,EAAE;yBACpB;wBACD,UAAU,EAAE;4BACV,UAAU,EAAE,IAAI,CAAC,EAAE,EAAE;4BACrB,UAAU,EA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