feat: improve operations diagnostics and channel management
This commit is contained in:
@@ -58,6 +58,28 @@ function createPrismaMock() {
|
||||
}
|
||||
|
||||
describe('DictionariesService', () => {
|
||||
it('builds the enterprise province and city library from distinct real phone segment regions', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
prisma.phoneSegment.findMany.mockResolvedValue([
|
||||
{ province: '山东', city: '青岛' },
|
||||
{ province: '山东', city: '济南' },
|
||||
{ province: '山东', city: '济南' },
|
||||
{ province: '江苏', city: '苏州' },
|
||||
{ province: ' ', city: '无效' },
|
||||
]);
|
||||
const service = new DictionariesService(prisma as never);
|
||||
|
||||
await expect(service.listAdministrativeRegions()).resolves.toEqual([
|
||||
{ province: '江苏', cities: ['苏州'] },
|
||||
{ province: '山东', cities: ['济南', '青岛'] },
|
||||
]);
|
||||
expect(prisma.phoneSegment.findMany).toHaveBeenCalledWith({
|
||||
where: { province: { not: null } },
|
||||
select: { province: true, city: true },
|
||||
distinct: ['province', 'city'],
|
||||
});
|
||||
});
|
||||
|
||||
it('deletes a phone segment from the real dictionary table', async () => {
|
||||
const prisma = createPrismaMock();
|
||||
const service = new DictionariesService(prisma as never);
|
||||
|
||||
Reference in New Issue
Block a user