This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST https://example.com/v1/users HTTP/1.1 | |
x-api-key: 99xcGdJkyi1t33J8KIscL1peEotukhjz4hhPquxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST https://example.com/v1/users HTTP/1.1 | |
### | |
POST https://example.com/v2/users HTTP/1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npx nyc report --reporter=html && npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
npm install --save-dev nyc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sinon.assert.called(index.tax) // 呼ばれたことの検証 | |
sinon.assert.calledOnce(index.tax) // 1回呼ばれたことの検証 | |
sinon.assert.notCalled(index.tax) // 呼ばれていないことの検証 | |
sinon.assert.calledTwice(index.tax) // 2回呼ばれたことの検証 | |
sinon.assert.callOrder(index.tax, index.age) // スタブしたメソッドの呼ばれた順序の検証 | |
sinon.assert.callCount(index.tax, 3) // スタブしたメソッドの呼ばれた回数の検証 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const chai = require('chai') | |
const sinon = require('sinon') | |
const sandbox = sinon.createSandbox() | |
const expect = chai.expect | |
describe('sinon', function () { | |
it('sinonのテスト', function(){ | |
sandbox.stub(process.env, 'PATH').value('12345') | |
expect(process.env.PATH).to.equal('12345') // passになる | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sinon = require('sinon') // sinon作成 | |
const sandbox = require('sinon').createSandbox() //sandbox作成 | |
afterEach(()=>{ | |
sandbox.restore()// sandboxをリストアすること | |
}) | |
after(()=>{ | |
sinon.restore() // sinonをリストアすること | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sam init | |
[+] Initializing project structure... | |
[SUCCESS] - Read sam-app/README.md for further instructions on how to proceed | |
[*] Project initialization is now complete | |
$ cd sam-app\hello_world | |
$ npm install // axiosとか入れておく | |
npm notice created a lockfile as package-lock.json. You should commit this file. | |
added 34 packages from 460 contributors and audited 44 packages in 4.494s | |
found 0 vulnerabilities |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
C:\Users\takahashi>sam --version | |
SAM CLI, version 0.6.2 |
NewerOlder