Skip to content

Commit

Permalink
fix arg data raw tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Oct 18, 2024
1 parent f58b2bb commit 56651f3
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/property/ic_api/arg_data_raw/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import {} from '@dfinity/agent';
import {} from '@dfinity/candid';
import {
defaultPropTestParams,
expect,
Expand All @@ -14,7 +12,7 @@ import { _SERVICE as Actor } from './dfx_generated/canister/canister.did';

export function getTests(): Test {
return () => {
it('gets the canister version from the canister', async () => {
it('gets the init arg data raw from the canister', async () => {
await fc.assert(
fc.asyncProperty(
// TODO once we figure out how to escape single quotes in candid strings
Expand All @@ -36,10 +34,6 @@ export function getTests(): Test {
}
);

const escapeArgData = (data: string): string => {
return data.replace(/[\\"]/g, '\\$&');
};

const initArgDataCandidString = `("${escapeArgData(
initArgData
)}")`;
Expand Down Expand Up @@ -109,3 +103,8 @@ export function getTests(): Test {
});
};
}

// TODO make sure this is a standalone function
function escapeArgData(data: string): string {
return data.replace(/[\\"]/g, '\\$&');
}

0 comments on commit 56651f3

Please sign in to comment.