Skip to content

Commit

Permalink
Add test verifying that issues #209 and #210 were with the playground…
Browse files Browse the repository at this point in the history
…, not library
  • Loading branch information
rkalis committed Oct 1, 2024
1 parent e69aaa9 commit d2b760b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions packages/cashscript/test/Contract.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { placeholder } from '@cashscript/utils';
import {
Contract,
ElectrumNetworkProvider,
MockNetworkProvider,
Network,
randomUtxo,
SignatureTemplate,
} from '../src/index.js';
import {
Expand Down Expand Up @@ -110,6 +112,21 @@ describe('Contract', () => {
});
});

describe('getUtxos', () => {
it('should return utxos for existing contract on mocknet', async () => {
const provider = new MockNetworkProvider();
const instance = new Contract(p2pkhArtifact, [alicePkh], { provider });

provider.addUtxo(instance.address, randomUtxo());

const utxos = await instance.getUtxos();
const utxosFromProvider = await provider.getUtxos(instance.address);

expect(utxos).toHaveLength(1);
expect(utxos).toEqual(utxosFromProvider);
});
});

describe('Contract functions', () => {
let instance: Contract;
let bbInstance: Contract;
Expand Down

0 comments on commit d2b760b

Please sign in to comment.