Stand vor Einführung des Nacht-Agenten
This commit is contained in:
commit
4763548bfb
168 changed files with 12726 additions and 0 deletions
16
packages/connector-mock/test/contract.test.ts
Normal file
16
packages/connector-mock/test/contract.test.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { runContract } from '@kc/connector-sdk/dist/contract.js';
|
||||
import { mockConnector, resetMock } from '../src/index.js';
|
||||
const ctx = (c: Record<string, unknown> = {}) => ({ config: { instance: 't', ...c }, secrets: {}, correlationId: 'c' });
|
||||
describe('Mock-Connector', () => {
|
||||
it('erfüllt den Vertrag', async () => { resetMock(); expect((await runContract(expect as never, mockConnector, ctx())).length).toBe(3); });
|
||||
it('sperrt und entsperrt', async () => {
|
||||
resetMock();
|
||||
expect((await mockConnector.execute!(ctx(), { action: 'suspend', externalRef: 'm-1', idempotencyKey: 'a' })).resource?.state).toBe('suspended');
|
||||
expect((await mockConnector.execute!(ctx(), { action: 'unsuspend', externalRef: 'm-1', idempotencyKey: 'b' })).resource?.state).toBe('active');
|
||||
});
|
||||
it('simuliert Ausfall', async () => {
|
||||
expect((await mockConnector.healthCheck(ctx({ simulateOutage: 'true' }))).ok).toBe(false);
|
||||
await expect(mockConnector.listResources(ctx({ simulateOutage: 'true' }))).rejects.toMatchObject({ code: 'UNREACHABLE', retryable: true });
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue