matchers.contains(number) support
See original GitHub issueGiven 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:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Check out the update in 1.4.2 and let me know if that works for you
Yes, no more exception! Thanks for the quick fix. Been getting a lot of mileage out of testdouble recently.