1
0
Fork 0

Revert "DataValidator: Always clear store state"

This breaks everything. :x

This reverts commit e0c2e4dc86, reversing
changes made to e610372c84.
master
Mike Gerwitz 2017-02-16 16:49:11 -05:00
parent e22aa2a880
commit eefd268abf
2 changed files with 1 additions and 39 deletions

View File

@ -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 )

View File

@ -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', () =>
{