feat: 客户页面改为站内查看存证和证书

This commit is contained in:
Nixevol
2026-11-15 12:15:04 +08:00
parent 6669722c00
commit 2955efb278
15 changed files with 253 additions and 70 deletions
@@ -26,15 +26,20 @@ describe('Consumer certificate lifecycle', () => {
afterEach(() => jest.restoreAllMocks());
it('GET only reads persisted state and never starts a job or calls Tianhe', async () => {
const { service, prisma, config } = fixture('NONE');
expect(await service.status('123456000001')).toMatchObject({ status: 'NONE', url: null });
expect(await service.status('123456000001')).toMatchObject({ status: 'NONE', certificate: null });
expect(prisma.blockchainProof.updateMany).not.toHaveBeenCalled();
expect(prisma.$transaction).not.toHaveBeenCalled();
expect(config.getAllRaw).not.toHaveBeenCalled();
});
it('returns an existing shared certificate without consulting credentials or submitting', async () => {
const { service, row, config } = fixture('READY');
row.certificateUrl = 'https://test.tichain.tianhecloud.com/#/certificate?address=' + settings.tianheWalletAddress + '&txHash=0x' + 'a'.repeat(64) + '&digest=' + 'b'.repeat(64);
expect(await service.request('123456000001')).toMatchObject({ status: 'READY', url: row.certificateUrl });
row.certificateUrl = 'https://test.tichain.tianhecloud.com/#/certificate?address=' + settings.tianheWalletAddress + '&txHash=0x' + 'a'.repeat(64) + '&digest=' + 'b'.repeat(64) + '&createTime=1789844077000';
const result = await service.request('123456000001');
expect(result).toMatchObject({
status: 'READY',
certificate: { text: 'frozen-evidence', digest: 'b'.repeat(64), txHash: '0x' + 'a'.repeat(64), author: settings.tianheWalletAddress, createdAt: '2026-09-19T18:54:37.000Z' },
});
expect(JSON.stringify(result)).not.toContain('tianhecloud');
expect(config.getAllRaw).not.toHaveBeenCalled();
});
it('does not send when another worker owns the lease', async () => {