Skip to content

Commit

Permalink
fix stringified
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz committed Oct 21, 2023
1 parent eb5ee24 commit 593a313
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/fast-check/test/unit/utils/stringify.spec.ts
Expand Up @@ -419,7 +419,8 @@ describe('stringify', () => {

// prettier-ignore
const instance3 = { [toStringMethod]: () => { throw new Error('hello3'); } };
expect(stringify(instance3)).toEqual(
const stringified3 = stringify(instance3);
expect(stringified3.replace(/[\s\n]+/g, ' ')).toEqual(
'{[Symbol("fast-check/toStringMethod")]:() => { throw new Error(\'hello3\'); }}',
); // fallbacking to default

Expand Down Expand Up @@ -555,7 +556,8 @@ describe('asyncStringify', () => {

// prettier-ignore
const instance4 = { [asyncToStringMethod]: async () => { throw new Error('hello4'); } };
expect(await asyncStringify(instance4)).toEqual(
const stringified4 = await asyncStringify(instance4);
expect(stringified4.replace(/[\s\n]+/g, ' ')).toEqual(
'{[Symbol("fast-check/asyncToStringMethod")]:async () => { throw new Error(\'hello4\'); }}',
); // fallbacking to default

Expand All @@ -565,7 +567,8 @@ describe('asyncStringify', () => {

// prettier-ignore
const instance6 = { [asyncToStringMethod]: () => { throw new Error('hello6'); } }; // throw is sync
expect(await asyncStringify(instance6)).toEqual(
const stringified6 = await asyncStringify(instance6);
expect(stringified6.replace(/[\s\n]+/g, ' ')).toEqual(
'{[Symbol("fast-check/asyncToStringMethod")]:() => { throw new Error(\'hello6\'); }}',
); // fallbacking to default

Expand Down

0 comments on commit 593a313

Please sign in to comment.