Skip to content

Commit d2b760b

Browse files
committed
Add test verifying that issues #209 and #210 were with the playground, not library
1 parent e69aaa9 commit d2b760b

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

packages/cashscript/test/Contract.test.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import { placeholder } from '@cashscript/utils';
33
import {
44
Contract,
55
ElectrumNetworkProvider,
6+
MockNetworkProvider,
67
Network,
8+
randomUtxo,
79
SignatureTemplate,
810
} from '../src/index.js';
911
import {
@@ -110,6 +112,21 @@ describe('Contract', () => {
110112
});
111113
});
112114

115+
describe('getUtxos', () => {
116+
it('should return utxos for existing contract on mocknet', async () => {
117+
const provider = new MockNetworkProvider();
118+
const instance = new Contract(p2pkhArtifact, [alicePkh], { provider });
119+
120+
provider.addUtxo(instance.address, randomUtxo());
121+
122+
const utxos = await instance.getUtxos();
123+
const utxosFromProvider = await provider.getUtxos(instance.address);
124+
125+
expect(utxos).toHaveLength(1);
126+
expect(utxos).toEqual(utxosFromProvider);
127+
});
128+
});
129+
113130
describe('Contract functions', () => {
114131
let instance: Contract;
115132
let bbInstance: Contract;

0 commit comments

Comments
 (0)