Skip to content

Commit

Permalink
npm run test-onchange-lcovonly
Browse files Browse the repository at this point in the history
  • Loading branch information
dex4er committed Mar 16, 2017
1 parent 11770be commit add1012
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,16 @@
"chai-as-promised": "^6.0.0",
"delay": "^1.3.1",
"nyc": "^10.1.2",
"onchange": "^3.2.1",
"snazzy": "^6.0.0",
"standard": "^9.0.1",
"tap": "^10.3.0",
"tap-given": "^0.2.0"
},
"scripts": {
"test": "standard --verbose | snazzy && tap test/*.js",
"test-coverage": "npm test -- --coverage"
"test-coverage": "npm test -- --coverage",
"test-onchange-lcovonly": "onchange '**/*.js' -- npm run -s test-coverage -- -R silent --coverage-report lcovonly"
},
"nyc": {
"exclude": []
Expand Down
30 changes: 30 additions & 0 deletions test/promise-socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,34 @@ Feature('Test promise-socket module', () => {
return this.promise.should.be.fulfilled
})
})

Scenario('Set timeout for socket two times', function () {
Given('Socket object', () => {
this.socket = new MockSocket()
})

Given('PromiseSocket object', () => {
this.promiseSocket = new PromiseSocket(this.stream)
})

When('I subscribe for end event', () => {
this.promise = this.promiseSocket.once('end')
})

When('I set timeout for socket first time', () => {
this.promiseSocket.setTimeout(2000)
})

When('I set timeout for socket another time', () => {
this.promiseSocket.setTimeout(500)
})

When('I wait for more that timeout', () => {
return delay(1000)
})

Then('socket is ended', () => {
return this.promise.should.be.fulfilled
})
})
})

0 comments on commit add1012

Please sign in to comment.