Skip to content

Commit e725c1f

Browse files
Remove useless dependencies and add the test for the rejected promises
1 parent fddd430 commit e725c1f

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ p3.then(() => alert('frame'))
4444
Promise.all([p1, p2, p3]).then(() => alert('We are all done!'))
4545
```
4646

47+
### Clear timer eventyally
48+
Thanks to [this pull request](https://github.com/GianlucaGuarini/allora/pull/3) it's now also possible to clear the timers
49+
```js
50+
const myWindow = allora(window)
51+
const timer = myWindow.setTimeout(3000)
52+
timer.then(_ => console.log('time over'))
53+
clearTimeout(timer)
54+
```
55+
4756
## "allora" meaning
4857

4958
"allora" is the Italian :it: word for `then`

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
"eslint-config-standard": "^5.3.5",
3030
"eslint-plugin-promise": "^2.0.0",
3131
"eslint-plugin-standard": "^2.0.0",
32-
"mocha": "^2.5.3",
33-
"sinon": "^1.17.4",
34-
"sinon-chai": "^2.8.0"
32+
"mocha": "^2.5.3"
3533
}
3634
}

test/index.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
const allora = require('../')
22

33
const chai = require('chai')
4-
// const sinon = require('sinon')
5-
const sinonChai = require('sinon-chai')
6-
const EventEmitter = require('events')
74
const expect = chai.expect
8-
chai.use(sinonChai)
5+
const EventEmitter = require('events')
96

107
describe('core', function () {
118
var emitter
@@ -48,4 +45,11 @@ describe('core', function () {
4845
coolGlobal.setTimeout(500)
4946
]).then(() => done())
5047
})
48+
49+
it('Reject the promise', function (done) {
50+
const coolGlobal = allora(global)
51+
coolGlobal.setImmediate().then(() => {
52+
throw new Error('Random error')
53+
}).catch(() => done())
54+
})
5155
})

0 commit comments

Comments
 (0)