fix: clarify signature reporting status

This commit is contained in:
hectorzhao
2026-07-13 10:16:12 +08:00
parent 551edfd8ca
commit 344b2afe3b
13 changed files with 140 additions and 26 deletions
@@ -128,4 +128,20 @@ describe('DictionariesService', () => {
);
expect(prisma.drainageField.create).toHaveBeenCalledTimes(1);
});
it('only accepts Arabic numerals and English letters in report field codes', async () => {
const prisma = createPrismaMock();
const service = new DictionariesService(prisma as never);
await expect(service.createDrainageField({ code: 'License2026', name: '营业执照', fieldType: 'image' })).resolves.toEqual(
expect.objectContaining({ code: 'License2026' }),
);
expect(() => service.createDrainageField({ code: 'license_code', name: '营业执照', fieldType: 'image' })).toThrow(
'code must contain only Arabic numerals and English letters',
);
expect(() => service.createDrainageField({ code: '营业执照', name: '营业执照', fieldType: 'image' })).toThrow(
'code must contain only Arabic numerals and English letters',
);
expect(prisma.drainageField.create).toHaveBeenCalledTimes(1);
});
});