demergent-labs / azle

A WebAssembly runtime for TypeScript and JavaScript on ICP
MIT License
194 stars 33 forks source link

toStrictEqual not behaving as expected #1806

Open bdemann opened 1 month ago

bdemann commented 1 month ago

Right now the work around is to just use toEqual instead.

This applies to the following examples

It would be nice if we could figure out why toStringEqual doesn't work because it seems like it should and feels like it would give us the more robust test result.

We first noticed this issue in apollo server. For both of it's tests we tried to use toStrictEquals but the tests failed even though everything we could see led us to suspect that they should pass.

console.log(typeof responseJson);
console.log(responseJson.constructor.name);
console.log(jsonStringify(responseJson));
console.log(JSON.stringify(responseJson));
console.log(Object.getPrototypeOf(responseJson));
console.log(Object.getOwnPropertySymbols(responseJson));

yielded the same result as:

console.log(typeof expectedResult);
console.log((expectedResult as any).constructor.name);
console.log(jsonStringify(expectedResult));
console.log(JSON.stringify(expectedResult));
console.log(Object.getPrototypeOf(expectedResult));
console.log(Object.getOwnPropertySymbols(expectedResult));
bdemann commented 1 month ago

It seems like this is only affecting http_server cansiters and not candid_rpc canisters