Skip to content

Commit

Permalink
Merge pull request #1505 from demergent-labs/0_19_0_fixes
Browse files Browse the repository at this point in the history
0 19 0 fixes
  • Loading branch information
lastmjs authored Dec 13, 2023
2 parents f4fdb8e + 8e58473 commit e8ac8cb
Show file tree
Hide file tree
Showing 40 changed files with 64 additions and 143 deletions.
4 changes: 4 additions & 0 deletions examples/bitcoin/test/pretest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { execSync } from 'child_process';
async function pretest() {
await new Promise((resolve) => setTimeout(resolve, 5000));

execSync(`rm -rf .bitcoin/regtest`, {
stdio: 'inherit'
});

execSync(`dfx canister uninstall-code bitcoin || true`, {
stdio: 'inherit'
});
Expand Down
6 changes: 5 additions & 1 deletion examples/bitcoin/test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const tests: Test[] = [
...impureSetup(wallets, state),
{
name: 'wait for blockchain balance to reflect',
wait: 120_000
wait: 60_000
},
...testCanisterFunctionality()
];
Expand All @@ -42,6 +42,10 @@ function testCanisterFunctionality() {
const blocksMinedInSetup = 101n;
const expectedBalance = blockReward * blocksMinedInSetup;

// TODO remove this after testing
console.log('result', result);
console.log('expectedBalance', expectedBalance);

return {
Ok: result === expectedBalance
};
Expand Down
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"homepage": "https://github.com/demergent-labs/azle#readme",
"dependencies": {
"@dfinity/candid": "github:demergent-labs/candid#minimum_viable",
"@dfinity/principal": "0.19.2",
"@dfinity/principal": "^0.19.3",
"@swc/core": "^1.3.86",
"@types/uuid": "^9.0.4",
"buffer": "^6.0.3",
Expand Down
2 changes: 1 addition & 1 deletion property_tests/are_params_correctly_ordered.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export function areParamsCorrectlyOrdered<T extends CorrespondingJSType>(
${el.src.valueLiteral}
)`;

return `if (!${areEqual}) throw new Error('${name} is incorrectly ordered')`;
return `if (!${areEqual}) {console.log('value', ${name}); throw new Error('${name} is incorrectly ordered');}`;
})
.join('\n');
}
15 changes: 15 additions & 0 deletions property_tests/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import fc from 'fast-check';
// @ts-ignore
import libraryDeepEqual from 'deep-is';

import { Canister } from './arbitraries/canister_arb';
import { existsSync, mkdirSync, writeFileSync } from 'fs';
import { execSync } from 'child_process';
Expand Down Expand Up @@ -72,3 +75,15 @@ export const defaultArrayConstraints = {
minLength: 20,
maxLength: 100
};

export function deepEqual(a: any, b: any): boolean {
const result = libraryDeepEqual(a, b);

if (result === false) {
console.log('deepEqual returned false');
console.log('deepEqual value a', a);
console.log('deepEqual value b', b);
}

return result;
}
5 changes: 1 addition & 4 deletions property_tests/tests/blob/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/bool/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/float32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/float64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/func/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Func } from 'azle/property_tests/arbitraries/candid/reference/func_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int16/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/int8/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat16/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/nat8/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/null/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/opt/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Opt } from 'azle/property_tests/arbitraries/candid/constructed/opt_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/principal/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import { Principal } from '@dfinity/principal';

// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/query_methods/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type';
import { CandidReturnType } from 'azle/property_tests/arbitraries/candid/candid_return_type_arb';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/record/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Record } from 'azle/property_tests/arbitraries/candid/constructed/record_arb';
import { Test } from 'azle/test';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/contains_key.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/get.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/insert.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/is_empty.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/items.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/keys.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { getArrayForCandidType, getArrayStringForCandidType } from './utils';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/len.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/remove.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
import { QueryMethod } from 'azle/property_tests/arbitraries/canister_methods/query_method_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/stable_b_tree_map/test/values.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import fc from 'fast-check';

// @ts-ignore
import deepEqual from 'deep-is';

import { StableBTreeMap } from 'azle/property_tests/arbitraries/stable_b_tree_map_arb';
import { getActor } from 'azle/property_tests';
import { deepEqual, getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
import { getArrayForCandidType, getArrayStringForCandidType } from './utils';
import { UniqueIdentifierArb } from 'azle/property_tests/arbitraries/unique_identifier_arb';
Expand Down
5 changes: 1 addition & 4 deletions property_tests/tests/text/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { deepEqual, getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
import { Test } from 'azle/test';

Expand Down
Loading

0 comments on commit e8ac8cb

Please sign in to comment.