From eefd268abf976d85343d44fa30972caecde40122 Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Thu, 16 Feb 2017 16:49:11 -0500 Subject: [PATCH] Revert "DataValidator: Always clear store state" This breaks everything. :x This reverts commit e0c2e4dc861d523c40b2d35a242e48b8b7c99662, reversing changes made to e610372c8443ba5c5e73ed0791e642d82772d5cd. --- src/validate/DataValidator.js | 3 +-- test/validate/DataValidatorTest.js | 37 ------------------------------ 2 files changed, 1 insertion(+), 39 deletions(-) diff --git a/src/validate/DataValidator.js b/src/validate/DataValidator.js index 1a7a90b..5b5c38b 100644 --- a/src/validate/DataValidator.js +++ b/src/validate/DataValidator.js @@ -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 ) diff --git a/test/validate/DataValidatorTest.js b/test/validate/DataValidatorTest.js index 8a526be..e209a13 100644 --- a/test/validate/DataValidatorTest.js +++ b/test/validate/DataValidatorTest.js @@ -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', () => {