Skip to content

fix(testing): Function signature of assertObjectEquals() does not accept interfaces #741 #763

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

Merged
merged 5 commits into from
Apr 5, 2021

Conversation

getspooky
Copy link
Contributor

@getspooky getspooky commented Feb 26, 2021

The type Record<PropertyKey, unknown> used in assertObjectEquals() does not accept interface types as an argument.

import { assertObjectMatch } from "https://deno.land/[email protected]/testing/asserts.ts";

interface NumberToken {
    type: "number";
    value: number;
}

const token: NumberToken = {
    type: "number",
    value: 15
};

assertObjectMatch(token, { type: "number" }); // doesn't work

type TNumberToken = {
    type: "number";
    value: number;
};

const typeToken: TNumberToken = {
    type: "number",
    value: 15
};

assertObjectMatch(typeToken, { type: "number" }); // works

The solution is to change assertObjectMatch first param from unknown to any.

@CLAassistant
Copy link

CLAassistant commented Feb 26, 2021

CLA assistant check
All committers have signed the CLA.

@getspooky
Copy link
Contributor Author

getspooky commented Apr 2, 2021

it would be good to fixe this issue. @wperron

Copy link
Contributor

@wperron wperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change looks good, but please revert the formatting changes as they're not pertinent to the change.

@getspooky
Copy link
Contributor Author

@wperron done.

@getspooky getspooky requested a review from wperron April 3, 2021 13:59
Copy link
Contributor

@wperron wperron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks

@wperron wperron merged commit 1333c6f into denoland:main Apr 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants