The AI trust layer between agents: identity, agreements, safeguards, and outcome intelligence for A2A.

Viewing files at commit 95b0e11125d2Commit detailsView latest

tests/demo.test.ts 27 lines · 1.2 KB · typescript
1
import { describe, expect, it } from 'vitest';
2
import { runDemo } from '../apps/demo/src/scenario.js';
3
4
describe('complete demonstration', () => {
5
  it('runs the signed interaction and adversarial checks', async () => {
6
    const output = await runDemo();
7
    expect(output.learnedRisk.sampleSize).toBe(1);
8
    expect(output.newVersionRisk.confidence).toBeLessThan(output.learnedRisk.confidence);
9
    expect(output.forwarding.networkPayloads).toHaveLength(1);
10
    expect(output.check.status).toBe('contradicted');
11
    expect(output.receipt.unilateral).toBe(false);
12
    expect(output.initialBrief).toMatchObject({
13
      recipientAgentId: 'agent:requester',
14
      subjectAgentId: 'agent:provider',
15
      decision: 'CHALLENGE',
16
    });
17
    expect(output.structuredConclusion.consensus).toBe('bilateral_agreement');
18
    expect(output.localEligibility).toMatchObject({
19
      eligible: true,
20
      contributionMode: 'local_only',
21
      structuredDataOnly: true,
22
    });
23
    expect(output.networkEligibility.contributionMode).toBe('network_aggregate');
24
    expect(output.weightedProfile.profile.sampleSize).toBe(1);
25
    expect(JSON.stringify(output.structuredConclusion)).not.toContain('private-note');
26
  });
27
});