Skip to content

Conversation

@javihernant
Copy link
Contributor

@javihernant javihernant commented Feb 21, 2024

  • expect.anything
  • expect.any
  • expect.arrayContaining
  • expect.not.arrayContaining

@javihernant
Copy link
Contributor Author

@iuioiua is this going the right direction? Are you missing something?

@iuioiua
Copy link
Contributor

iuioiua commented Feb 21, 2024

I'll leave this one to @kt3k, who's lead std/expect efforts so far.

import { expect } from "./expect.ts";
import { AssertionError, assertThrows } from "../assert/mod.ts";

Deno.test("expect().anything()", () => {
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
Deno.test("expect().anything()", () => {
Deno.test("expect.anything()", () => {

@kt3k
Copy link
Member

kt3k commented Feb 22, 2024

@javihernant This looks heading in the right direction to me!

@javihernant javihernant changed the title Add expect.anything() #3964 Add asymmetric matchers (#3964) Feb 22, 2024
@javihernant javihernant marked this pull request as ready for review February 22, 2024 18:38
@javihernant javihernant requested a review from kt3k February 22, 2024 18:39
@kt3k kt3k changed the title Add asymmetric matchers (#3964) feat(expect): add asymmetric matchers (#3964) Feb 23, 2024
Deno.test("expect.anything() as a parameter of toHaveBeenCalled()", () => {
const mockFn = fn();
mockFn(3);
expect(mockFn).toHaveBeenCalledWith(expect.anything());
Copy link
Member

Choose a reason for hiding this comment

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

👍

Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

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

Looks nicely implemented and tested! Thanks for your contribution!

@kt3k kt3k merged commit 5d15ab7 into denoland:main Feb 28, 2024
@kt3k kt3k mentioned this pull request Mar 5, 2024
20 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants