diff options
author | Mike Gerwitz <gerwitzm@lovullo.com> | 2017-01-29 23:21:14 -0500 |
---|---|---|
committer | Mike Gerwitz <gerwitzm@lovullo.com> | 2017-01-30 00:29:25 -0500 |
commit | 28d74d70685e0824b5895979d7603587c87b651b (patch) | |
tree | fa5cd8f3a305d98fa20a7ba9812f51ef91278007 /test | |
parent | 24180e704aaec8b1610a24d1f76ba66e70e97b02 (diff) | |
download | liza-28d74d70685e0824b5895979d7603587c87b651b.tar.gz liza-28d74d70685e0824b5895979d7603587c87b651b.tar.bz2 liza-28d74d70685e0824b5895979d7603587c87b651b.zip |
ValidStateMonitor: handle empty diff on past failure
See the description in the test case. This is a bug fix.
* src/validate/ValidStateMonitor.js
(_checkCauseFix): Do not consider an empty diff on a past failure to
be a fix.
* test/validate/ValidStateMonitorTest.js: Add test.
DEV-2296
Diffstat (limited to 'test')
-rw-r--r-- | test/validate/ValidStateMonitorTest.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/validate/ValidStateMonitorTest.js b/test/validate/ValidStateMonitorTest.js index 75dab73..52dc272 100644 --- a/test/validate/ValidStateMonitorTest.js +++ b/test/validate/ValidStateMonitorTest.js @@ -318,6 +318,25 @@ describe( 'ValidStateMonitor', function() } ); + // if a diff is present for a previously failed key (e.g. foo), + // but contains no changes (e.g. [ undefined ]), and doesn't + // include the failure on the second call, then it should not be + // considered to be a fix (this is a bugfix) + it( 'keeps past failures on key if failure does not reoccur', () => + { + const fail_past = mkfail( 'foo', [ 'bar', 'baz' ] ); + + return mkstore( { foo: [ undefined, undefined ] } ) + .then( data => + Sut() + .update( data, { foo: fail_past } ) + // no failure or fix (foo has no updates) + .then( sut => sut.update( data, {} ) ) + .then( sut => expect( sut.hasFailures() ).to.be.true ) + ); + } ); + + it( 'does not trigger failure event for existing', function() { var called = 0; |