question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

matchers.contains(number) support

See original GitHub issue

Given this repro snippet

const td = require('testdouble')

const repro = td.function()
repro([1])
td.verify(repro(td.matchers.contains(1)))

I’d like this to succeed, but currently it throws an exception “Error: Error: testdouble.js - td.matchers.contains - this matcher only supports strings, arrays, and plain objects”

I think to fix this is just a matter of or _.isNumber(containing) on https://github.com/testdouble/testdouble.js/blob/30e27f54de0e84fe99a9c33340a0474c3a21369b/src/matchers/index.coffee#L45

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
searlscommented, Apr 29, 2016

Check out the update in 1.4.2 and let me know if that works for you

0reactions
focusauruscommented, Apr 29, 2016

Yes, no more exception! Thanks for the quick fix. Been getting a lot of mileage out of testdouble recently.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Hamcrest Number Matchers - Baeldung
A quick and practical guide to Hamcrest Number matchers. ... Hamcrest provides static matchers to help make unit test assertions simpler and ...
Read more >
Matchers (Hamcrest)
Creates a matcher that matches arrays whose elements are satisfied by the specified matchers. Matches positively only if the number of matchers specified...
Read more >
MATCH function - Microsoft Support
The MATCH function searches for a specified item in a range of cells, and then returns the relative position of that item in...
Read more >
googletest/matchers.md at main - GitHub
Contains (e).Times(n), argument contains elements that match e , which can be either a value or a matcher, and the number of matches...
Read more >
Hamcrest Matchers.contains matcher not working (?)
I tried do it using excellent Hamcrest matching classes, by combining contains with Matchers.hasToString , but somehow, its Matchers.contains is ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found