test( 'should reject deserializing entries it cannot validate', () => { const consoleSpy = jest.spyOn( console, 'warn' ).mockImplementation( () => {} ); const unvalidatedObject = deepFreeze( { hi: 'there' } ); chaiExpect( items( unvalidatedObject, { type: DESERIALIZE } ) ).to.deep.equal( {} ); consoleSpy.mockRestore(); } );
afterEach(() => { global.console.info.mockRestore() global.console.error.mockRestore() global.console.warn.mockRestore() global.console.log.mockRestore() })
test('remove node', async () => { const api = await createPlugin() const collection = api.store.addCollection('TestPost') const emit = jest.spyOn(collection._events, 'emit') const node = collection.addNode({ id: 'test' }) collection.removeNode('test') const entry = api.store.store.nodeIndex.getEntry(node.$uid) expect(collection.getNode('test')).toBeNull() expect(emit).toHaveBeenCalledTimes(2) expect(entry).toBeNull() emit.mockRestore() })
afterAll(() => { Service.mergeSchemaSettings.mockRestore(); Service.mergeSchemaMetadata.mockRestore(); Service.mergeSchemaHooks.mockRestore(); Service.mergeSchemaActions.mockRestore(); Service.mergeSchemaMethods.mockRestore(); Service.mergeSchemaEvents.mockRestore(); Service.mergeSchemaLifecycleHandlers.mockRestore(); Service.mergeSchemaUniqArray.mockRestore(); Service.mergeSchemaUnknown.mockRestore(); });
afterEach(() => { teardown(); Dropout.prototype.validate.mockRestore(); });
describe('.bindEquation()', () => { beforeEach(() => { jest.spyOn(RNN, 'getEquation'); }); afterEach(() => { RNN.getEquation.mockRestore(); }); it('calls static getEquation method', () => { const net = new RNN(); net.initialize(); net.bindEquation(); expect(RNN.getEquation).toBeCalled(); }); });
afterAll( () => { global.MutationObserver.mockRestore(); } );
afterEach(() => { LSTMTimeStep.prototype.trainArrays.mockRestore(); Equation.prototype.predictTarget.mockRestore(); });
afterAll( () => { global.console.error.mockRestore(); } );
afterEach(() => { LSTMTimeStep.prototype.trainInputOutput.mockRestore(); Equation.prototype.predictTarget.mockRestore(); });
test('remove node', async () => { const api = await createPlugin() const collection = api.store.addCollection('TestPost') const emit = jest.spyOn(collection._events, 'emit') const node = collection.addNode({ id: 'test' }) collection.removeNode('test') const entry = api.store.store.nodeIndex.getEntry(node.$uid) expect(collection.getNode('test')).toBeNull() expect(emit).toHaveBeenCalledTimes(2) expect(entry).toBeNull() emit.mockRestore() })
afterEach(() => { LSTMTimeStep.prototype.trainArrays.mockRestore(); Equation.prototype.predictTarget.mockRestore(); });
afterEach(() => { LSTMTimeStep.prototype.trainArrays.mockRestore(); Equation.prototype.predictTarget.mockRestore(); });
afterEach(() => { LSTMTimeStep.prototype.trainInputOutput.mockRestore(); Equation.prototype.predictTarget.mockRestore(); });
afterEach(() => { LSTMTimeStep.prototype.trainInputOutput.mockRestore(); Equation.prototype.predictTarget.mockRestore(); });