Revert "DataValidator: Always clear store state"
This breaks everything. :x This reverts commitmastere0c2e4dc86
, reversing changes made toe610372c84
.
parent
e22aa2a880
commit
eefd268abf
|
@ -217,8 +217,7 @@ module.exports = Class( 'DataValidator',
|
|||
{
|
||||
if ( data === undefined )
|
||||
{
|
||||
// it's important that we don't re-use previous state
|
||||
return store.clear().then( [] );
|
||||
return Promise.resolve( [] );
|
||||
}
|
||||
|
||||
const mapf = ( subkey !== undefined )
|
||||
|
|
|
@ -205,43 +205,6 @@ describe( 'DataValidator', () =>
|
|||
} );
|
||||
|
||||
|
||||
[
|
||||
[],
|
||||
[ {} ],
|
||||
[ undefined ],
|
||||
[ undefined, {} ],
|
||||
[ undefined, undefined ],
|
||||
[ {}, undefined ],
|
||||
].forEach( args => it( 'does not re-use previous store state', () =>
|
||||
{
|
||||
const stores = {
|
||||
store: MemoryStore(),
|
||||
bstore: sinon.createStubInstance( MemoryStore ),
|
||||
cstore: sinon.createStubInstance( MemoryStore ),
|
||||
};
|
||||
|
||||
const { sut, getStore } = createStubs( {
|
||||
getStore: () => stores,
|
||||
} );
|
||||
|
||||
const { bstore, cstore } = stores;
|
||||
|
||||
const cleared = which =>
|
||||
{
|
||||
cleared[ which ] = true;
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
bstore.clear = () => cleared( 'b' );
|
||||
cstore.clear = () => cleared( 'c' );
|
||||
|
||||
return sut.validate.apply( sut, args )
|
||||
.then( () =>
|
||||
expect( cleared.b && cleared.c ).to.be.true
|
||||
);
|
||||
} ) );
|
||||
|
||||
|
||||
// otherwise system might get into an unexpected state
|
||||
it( 'queues concurrent validations', () =>
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue