test('rollbacks unsuccessful transaction', async (t) => { const pool = createPool(); await t.throwsAsync(pool.transaction(async () => { return Promise.reject(new Error('foo')); })); t.assert(pool.querySpy.getCall(0).args[0] === 'START TRANSACTION'); t.assert(pool.querySpy.getCall(1).args[0] === 'ROLLBACK'); });
describe(URL, function() { it(".todoappにスタイルが適応されている", function() { cy.visit(URL).then((win) => { const position = win.getComputedStyle(win.document.querySelector(".todoapp")).position; expect(position).to.equal("relative"); }); cy.get("#js-todo-count").should(count => { expect(count).to.contain("0"); }); }); it("ロードするとApp.jsのログが表示される", function() { visitWithConsole(URL).then(({ logSpy }) => { const log0 = logSpy.getCall(0).args[0]; const log1 = logSpy.getCall(1).args[0]; expect(log0).to.equal("App.js: loaded"); expect(log1).to.equal("App initialized"); }); }); });
const message = console.log.getCall(0).args[0]; assert.equal(message, "Markdown data could not be retrieved."); consoleStub.restore();
sinon.stub(cache, '__del').returns(false); cache.remove('test'); const call = cache.log.debug.getCall(0); expect(_.includes(call.args[0], 'Failed')).to.equal(true); cache.log.debug.callCount.should.equal(2);
sinon.stub(cache, '__set').returns(false); cache.set('test', 'thing'); const call = cache.log.debug.getCall(0); expect(_.includes(call.args[0], 'Failed')).to.equal(true); cache.log.debug.callCount.should.equal(1);
await recorder.promise(); assert.ok(screenshotSaved.called); assert.equal('Scenario_with_data_driven.failed.png', screenshotSaved.getCall(0).args[0]); }); await recorder.promise(); assert.ok(screenshotSaved.called); assert.equal('test1.failed.png', screenshotSaved.getCall(0).args[0]); }); await recorder.promise(); assert.ok(screenshotSaved.called); assert.equal('test1_1.failed.png', screenshotSaved.getCall(0).args[0]); }); await recorder.promise(); assert.ok(screenshotSaved.called); const fileName = screenshotSaved.getCall(0).args[0]; const regexpFileName = /test1_[0-9]{10}.failed.png/; assert.equal(fileName.match(regexpFileName).length, 1);
attributes )( spy ).then( () => { const action = spy.getCall( 0 ).args[ 0 ];
expect( spy ).to.have.been.calledThrice; const action1 = spy.getCall( 1 ).args[ 0 ]; expect( action1.type ).to.equal( PUBLICIZE_CONNECTIONS_RECEIVE ); expect( action1.siteId ).to.equal( 2916284 ); expect( action1.data.connections ).to.eql( [ { ID: 2, site_ID: 2916284 } ] ); const action2 = spy.getCall( 2 ).args[ 0 ]; expect( action2.type ).to.equal( PUBLICIZE_CONNECTIONS_REQUEST_SUCCESS ); expect( action2.siteId ).to.equal( 2916284 ); expect( spy ).to.have.been.calledTwice; const action = spy.getCall( 1 ).args[ 0 ]; expect( action.type ).to.equal( PUBLICIZE_CONNECTIONS_REQUEST_FAILURE ); expect( action.siteId ).to.equal( 77203074 );
expect( spy ).to.have.been.calledThrice; const action1 = spy.getCall( 1 ).args[ 0 ]; expect( action1.type ).to.equal( PUBLICIZE_CONNECTION_RECEIVE ); expect( action1.siteId ).to.equal( 2916284 ); expect( action1.connection ).to.eql( { ID: 2, site_ID: 2916284 } ); const action2 = spy.getCall( 2 ).args[ 0 ]; expect( action2.type ).to.equal( PUBLICIZE_CONNECTION_REQUEST_SUCCESS ); expect( action2.connectionId ).to.equal( 2 ); expect( spy ).to.have.been.calledTwice; const action = spy.getCall( 1 ).args[ 0 ]; expect( action.type ).to.equal( PUBLICIZE_CONNECTION_REQUEST_FAILURE ); expect( action.connectionId ).to.equal( 2 );
const action = spy.getCall( 0 ).args[ 0 ];
describe(URL, function() { it(".todoappにスタイルが適応されている", function() { cy.visit(URL).then((win) => { const position = win.getComputedStyle(win.document.querySelector(".todoapp")).position; expect(position).to.equal("relative"); }); cy.get("#js-todo-count").should(count => { expect(count).to.contain("0"); }); }); it("ロードするとApp.jsのログが表示される", function() { visitWithConsole(URL).then(({ logSpy }) => { const log0 = logSpy.getCall(0).args[0]; const log1 = logSpy.getCall(1).args[0]; expect(log0).to.equal("App.js: loaded"); expect(log1).to.equal("App initialized"); }); }); });