Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] Fix network tests #787

Merged
merged 3 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aleohq/sdk",
"version": "0.6.2",
"version": "0.6.3",
"description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions",
"collaborators": [
"The Aleo Team <[email protected]>"
Expand Down
23 changes: 6 additions & 17 deletions sdk/tests/network-client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('NodeConnection', () => {
describe('getBlock', () => {
it('should return a Block object', async () => {
const block = await connection.getBlock(1);
expect((block as Block).block_hash).toEqual("ab1n79nyqnxa76wpz40efqlq53artsw86wrez4tw9kn5xrpuc65xyxquh3wnw");
expect((block as Block).block_hash).toEqual("ab1hap8jlxaz66yt887gxlgxptkm2y0dy72x529mq6pg3ysy9tzwyqsphva9c");
}, 60000);

it('should throw an error if the request fails', async () => {
Expand All @@ -35,8 +35,8 @@ describe('NodeConnection', () => {
const blockRange = await connection.getBlockRange(1, 3);
expect(Array.isArray(blockRange)).toBe(true);
expect((blockRange as Block[]).length).toBe(2);
expect(((blockRange as Block[])[0] as Block).block_hash).toBe("ab1n79nyqnxa76wpz40efqlq53artsw86wrez4tw9kn5xrpuc65xyxquh3wnw");
expect(((blockRange as Block[])[1] as Block).block_hash).toBe("ab1ywy38xs5c73s2q9v3mgyes5cup5wwtg8r2mlad0534zdmltadcrq9dpuw6");
expect(((blockRange as Block[])[0] as Block).block_hash).toBe("ab1hap8jlxaz66yt887gxlgxptkm2y0dy72x529mq6pg3ysy9tzwyqsphva9c");
expect(((blockRange as Block[])[1] as Block).block_hash).toBe("ab18dzmjgqgk5z6x4gggezca7aenqts7289chvhus4a7ydrcj4apvrqq5j5h8");

}, 60000);

Expand Down Expand Up @@ -88,8 +88,8 @@ describe('NodeConnection', () => {

describe('getTransaction', () => {
it('should return a Transaction object', async () => {
const transaction = await connection.getTransaction('at1ps9rynpue84asfhswp305fzytdy3a99w3yrml2zgg84d7p32wuxq4mq9cc');
expect((transaction as Transaction).type).toBe("execute");
const transaction = await connection.getTransaction('at1u833jaha7gtqk7vx0yczcg2njds2tj52lyg54c7zyylgfjvc4vpqn8gqqx');
expect((transaction as Transaction).type).toBe("deploy");
}, 60000);

it('should throw an error if the request fails', async () => {
Expand All @@ -109,17 +109,6 @@ describe('NodeConnection', () => {
}, 60000);
});

describe('getTransitionId', () => {
it('should return a transition id', async () => {
const transition = await connection.getTransitionId('5933570015305968530125784572086807293992783852506506765106247734494477879199field')
expect(typeof transition).toBe('string');
}, 60000);

it('should throw an error if the request fails', async () => {
await expect(connection.getTransitionId("garbage")).rejects.toThrow("Error fetching transition ID.");
}, 60000);
});

describe('findUnspentRecords', () => {
it('should fail if block heights or private keys are incorrectly specified', async () => {
await expect(connection.findUnspentRecords(5, 0, beaconPrivateKeyString, undefined, undefined, [])).rejects.toThrow();
Expand All @@ -139,7 +128,7 @@ describe('NodeConnection', () => {

describe('getProgramImports', () => {
it('should return the correct program import names', async () => {
const importNames = await connection.getProgramImportNames("disperse_multiple_transactions.aleo");
const importNames = await connection.getProgramImportNames("aleoswap05.aleo");
const expectedNames = ["credits.aleo"];
expect(importNames).toEqual(expectedNames);

Expand Down
2 changes: 1 addition & 1 deletion wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aleohq/wasm",
"version": "0.6.2",
"version": "0.6.3",
"description": "Wasm build for the SDK",
"collaborators": [
"The Aleo Team <[email protected]>"
Expand Down
Loading