Closed phillipskevin closed 6 years ago
Another option (given by @christopherjbaker via @imaustink) is to only assert if the warning matches the expected value along with expect(...)
to make sure the correct number of warnings are given like this test.
I think the best option would be a built in mechanism, something like canDev.mockWarn('expected warning')
or canDev.mockWarn([ 'expected warning', 'other warning' ])
. Besides simplifying the tests instead of having that code every time, it would also make future changes to this logic simpler. =]
We may want to create a can-test-helpers
module for useful functions like this.
We have many tests that assert the value of a warning message. When other
can-*
repos add new warnings, these tests often break. We should use a flag to only assert the value of warning messages when we're making thestache(...)
call we're trying to test. We should be able to do this with a simple flag: