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

use the deep-equal library instead of the fast-equals library to over… #1495

Merged
merged 5 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
665 changes: 655 additions & 10 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
},
"devDependencies": {
"@dfinity/agent": "^0.19.2",
"@types/deep-equal": "^1.0.4",
"@types/fs-extra": "9.0.13",
"deep-equal": "^2.2.3",
"deep-is": "^0.1.4",
"eslint": "8.11.0",
"eslint-config-prettier": "8.5.0",
"fast-check": "^3.13.1",
"fast-equals": "5.0.1",
"husky": "7.0.4",
"lint-staged": "12.3.7",
"prettier": "^3.0.3"
Expand Down
4 changes: 4 additions & 0 deletions property_tests/arbitraries/candid/to_src_literal/float.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ export function floatToSrcLiteral(value: number): string {
return 'Number.NaN';
}
if (Number.isFinite(value)) {
if (value === 0 && 1 / value === -Infinity) {
return '-0';
}

return value.toString();
}
if (value > 0) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Principal } from '@dfinity/principal';

export function principalToSrcLiteral(value: Principal): string {
// TODO solve the underlying principal problem https://github.com/demergent-labs/azle/issues/1443
return `DfinityPrincipal.fromText('${value.toText()}')`;
return `Principal.fromText('${value.toText()}')`;
}
9 changes: 3 additions & 6 deletions property_tests/arbitraries/canister_arb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,9 @@ function generateSourceCode(

return /*TS*/ `
import { ${imports} } from 'azle';
import { deepEqual } from 'fast-equals';
// import * as deepEqual from 'fast-deep-equal';
// TODO solve the underlying principal problem https://github.com/demergent-labs/azle/issues/1443
// import { Principal as DfinityPrincipal } from '@dfinity/principal';
// import { Principal as DfinityPrincipal } from 'azle';
import { DfinityPrincipal } from 'azle';

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

${declarations}

Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/blob/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/blob/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/bool/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/bool/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/float32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/float32/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/float64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/float64/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/func/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/func/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/int/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/int/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/int16/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/int16/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/int32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/int32/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/int64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/int64/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/int8/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/int8/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/nat/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/nat/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/nat16/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/nat16/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/nat32/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/nat32/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/nat64/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/nat64/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/nat8/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/nat8/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/null/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/null/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/opt/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/opt/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
4 changes: 3 additions & 1 deletion property_tests/tests/principal/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Principal } from '@dfinity/principal';
import { deepEqual } from 'fast-equals';

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

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/principal/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"module": "CommonJS",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/query_methods/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CorrespondingJSType } from 'azle/property_tests/arbitraries/candid/corresponding_js_type';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/query_methods/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/record/test/generate_tests.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { deepEqual } from 'fast-equals';
// @ts-ignore
import deepEqual from 'deep-is';

import { getActor, Named } from 'azle/property_tests';
import { CandidValueAndMeta } from 'azle/property_tests/arbitraries/candid/candid_value_and_meta_arb';
Expand Down
3 changes: 2 additions & 1 deletion property_tests/tests/record/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
3 changes: 2 additions & 1 deletion property_tests/tests/service/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"esModuleInterop": true
}
}
4 changes: 3 additions & 1 deletion property_tests/tests/stable_b_tree_map/test/contains_key.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fc from 'fast-check';
import { deepEqual } from 'fast-equals';

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

import { getActor } from 'azle/property_tests';
import { Test } from 'azle/test';
Expand Down
4 changes: 3 additions & 1 deletion property_tests/tests/stable_b_tree_map/test/get.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fc from 'fast-check';
import { deepEqual } from 'fast-equals';

// @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';
Expand Down
Loading
Loading