diff options
author | Mike Gerwitz <gerwitzm@lovullo.com> | 2017-02-02 13:59:17 -0500 |
---|---|---|
committer | Mike Gerwitz <gerwitzm@lovullo.com> | 2017-02-02 14:01:13 -0500 |
commit | c7b5ce559501dfc836e6075e8a7ceffdceb1847f (patch) | |
tree | b8c4609e24bb2be674ea5731a13febe82fd240a7 /test/validate | |
parent | 61a59db4e0e10a4bb3c6f2347192280c351e47b7 (diff) | |
download | liza-c7b5ce559501dfc836e6075e8a7ceffdceb1847f.tar.gz liza-c7b5ce559501dfc836e6075e8a7ceffdceb1847f.tar.bz2 liza-c7b5ce559501dfc836e6075e8a7ceffdceb1847f.zip |
DataValidator, ValidStateMonitor: Add #clearFailures
* src/validate/DataValidator.js (clearFailures): Add public method.
* test/validate/DataValidatorTest.js: Add #clearFailures test.
* src/validate/ValidStateMonitor.js (clearFailures): Add public method.
* test/validate/ValidStateMonitorTest.js: Add #clearFailures test.
Diffstat (limited to 'test/validate')
-rw-r--r-- | test/validate/DataValidatorTest.js | 24 | ||||
-rw-r--r-- | test/validate/ValidStateMonitorTest.js | 29 |
2 files changed, 53 insertions, 0 deletions
diff --git a/test/validate/DataValidatorTest.js b/test/validate/DataValidatorTest.js index f01eb0f..8ff4af9 100644 --- a/test/validate/DataValidatorTest.js +++ b/test/validate/DataValidatorTest.js @@ -213,6 +213,30 @@ describe( 'DataValidator', () => ).to.eventually.be.rejectedWith( expected_e ); } ); } ); + + + describe( '#clearFailures', () => + { + it( 'marks all failures as fixed', () => + { + const bvalidator = createMockBucketValidator(); + const vmonitor = ValidStateMonitor(); + const dep_factory = createMockDependencyFactory(); + + const mock_vmonitor = sinon.mock( vmonitor ); + + const sut = Sut( + bvalidator, vmonitor, dep_factory, createStubStore() + ); + + mock_vmonitor.expects( 'clearFailures' ).once(); + + expect( sut.clearFailures() ) + .to.equal( sut ); + + mock_vmonitor.verify(); + } ); + } ); } ); diff --git a/test/validate/ValidStateMonitorTest.js b/test/validate/ValidStateMonitorTest.js index 52dc272..5c44cb4 100644 --- a/test/validate/ValidStateMonitorTest.js +++ b/test/validate/ValidStateMonitorTest.js @@ -592,6 +592,35 @@ describe( 'ValidStateMonitor', function() } ); } ); } ); + + + describe( '#clearFailures', () => + { + it( 'clears all failures', () => + { + return new Promise( ( accept, reject ) => + { + mkstore( {} ).then( empty => + { + const sut = Sut(); + + return sut + .on( 'fix', fixed => + { + expect( fixed ) + .to.deep.equal( { foo: [ undefined ] } ); + + expect( sut.hasFailures() ).to.be.false; + + accept( true ); + } ) + .update( empty, { foo: mkfail( 'foo', [ 'bar' ] ) } ) + .then( sut => sut.clearFailures() ); + } ) + .catch( e => reject( e ) ); + } ); + } ); + } ); } ); |