describe( 'isRequesting', () => { test( 'Should get `false` if this site is not in the current state', () => { expect( selectors.isRequesting( state, 'no.site' ) ).to.be.false; } ); test( 'Should get `false` if this site is not being fetched', () => { expect( selectors.isRequesting( state, 'site.one' ) ).to.be.false; } ); test( 'Should get `true` if this site is being fetched', () => { expect( selectors.isRequesting( state, 'site.three' ) ).to.be.true; } ); } );
test( 'should default to a new PostQueryManager', () => { const state = allSitesQueries( undefined, {} ); expect( state ).to.be.an.instanceof( PostQueryManager ); expect( state.data ).to.eql( { items: {}, queries: {} } ); expect( state.options ).to.eql( { itemKey: 'global_ID' } ); } );
describe('gae_flex_postgres_connect', () => { it('should be listening', async () => { const child = childProcess.exec(`node ${appPath}`); const isOpen = await waitPort({port: PORT}); expect(isOpen).to.be.true; process.kill(child.pid, 'SIGTERM'); }); });
it('registers a known event via .on() with { times }', function() { const handler = new Handler(); const { _eventEmitter: eventEmitter } = handler; handler.on('request', () => {}, { times: 2 }); expect(eventEmitter.hasListeners('request')).to.be.true; eventEmitter.emitSync('request'); expect(eventEmitter.hasListeners('request')).to.be.true; eventEmitter.emitSync('request'); expect(eventEmitter.hasListeners('request')).to.be.false; });
it('should disable passthrough when calling abort and vise versa', function() { const interceptor = new Interceptor(); expect(interceptor.shouldAbort).to.be.false; expect(interceptor.shouldPassthrough).to.be.false; interceptor.abort(); expect(interceptor.shouldAbort).to.be.true; expect(interceptor.shouldPassthrough).to.be.false; interceptor.passthrough(); expect(interceptor.shouldAbort).to.be.false; expect(interceptor.shouldPassthrough).to.be.true; });
it('should have the correct defaults', function() { const interceptor = new Interceptor(); expect(interceptor.type).to.equal('intercept'); expect(interceptor.shouldAbort).to.be.false; expect(interceptor.shouldPassthrough).to.be.false; expect(interceptor.shouldIntercept).to.be.true; expect(interceptor.shouldStopPropagating).to.be.false; });
it('registers a known event via .on() with .times() and override with { times }', function() { const handler = new Handler(); const { _eventEmitter: eventEmitter } = handler; handler.times(2).on('request', () => {}, { times: 1 }); expect(eventEmitter.hasListeners('request')).to.be.true; eventEmitter.emitSync('request'); expect(eventEmitter.hasListeners('request')).to.be.false; });
describe('Unit | Adapter', function() { it('should exist', function() { expect(Adapter).to.be.a('function'); }); });
it('.passthrough()', function() { const interceptor = new Interceptor(); expect(interceptor.shouldPassthrough).to.be.false; expect(interceptor.shouldIntercept).to.be.true; interceptor.passthrough(); expect(interceptor.shouldPassthrough).to.be.true; expect(interceptor.shouldIntercept).to.be.false; });
test( 'should not load invalid persisted state', () => { const original = '{INVALID'; const state = allSitesQueries( original, { type: DESERIALIZE } ); expect( state ).to.be.an.instanceof( PostQueryManager ); expect( state.data ).to.eql( { items: {}, queries: {} } ); expect( state.options ).to.eql( { itemKey: 'global_ID' } ); } );
describe('Unit | Adapter', function() { it('should exist', function() { expect(Adapter).to.be.a('function'); }); });
it('.passthrough()', function() { const interceptor = new Interceptor(); expect(interceptor.shouldPassthrough).to.be.false; expect(interceptor.shouldIntercept).to.be.true; interceptor.passthrough(); expect(interceptor.shouldPassthrough).to.be.true; expect(interceptor.shouldIntercept).to.be.false; });