DrPotatD
Denoβ€’3y agoβ€’
3 replies
DrPotat

How to assert object with a field of a given type?

Hi, I'm writing an integration test that needs to assert an object response, where the ID field can be of type string:

const json = await res.json();
assertObjectMatch(json, {
    data: {
        object: "VerificationRequest",
        id: expect.any(String)
    },
});


The expect.any(String) line doesn't work because that syntax is from Jest: https://jestjs.io/docs/expect#expectanyconstructor

Is there any way to do this in Deno?
Was this page helpful?