Skip to content

Commit

Permalink
test(ERTP): balance {x, y, z} >= {z}
Browse files Browse the repository at this point in the history
  • Loading branch information
dckc authored and kriskowal committed Oct 22, 2024
1 parent b121160 commit 8b885fa
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { test } from '@agoric/swingset-vat/tools/prepare-test-env-ava.js';
import { getCopySetKeys, makeCopySet } from '@agoric/store';

import { Far } from '@endo/far';
import { AmountMath as m, AssetKind } from '../../../src/index.js';
import { mockCopySetBrand as mockBrand } from './mockBrand.js';

Expand Down Expand Up @@ -291,3 +292,16 @@ test('copySet with strings subtract', t => {
`['a', 'b'] - ['a'] = ['a']`,
);
});

const mockHandle = iface => Far(iface, {});

test('balance {x, y, z} >= {z}', t => {
const x = { instance: mockHandle('Foo'), description: 'fraz' };
const y = { instance: mockHandle('Foo'), description: 'fraz' };
const z = { instance: mockHandle('Foo'), description: 'alan' };

const balance = harden({ brand: mockBrand, value: makeCopySet([x, y, z]) });
const withdraw = harden({ brand: mockBrand, value: makeCopySet([z]) });

t.true(m.isGTE(balance, withdraw));
});

0 comments on commit 8b885fa

Please sign in to comment.