Skip to content

Commit 9688fde

Browse files
committed
spec: update tests for promises
1 parent c5c78ad commit 9688fde

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

index.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ function getAuthStatus(type) {
1919
return permissions.getAuthStatus.call(this, type)
2020
}
2121

22-
function askForMediaAccess(type, callback) {
22+
function askForMediaAccess(type) {
2323
if (!['microphone', 'camera'].includes(type)) {
2424
throw new TypeError(`${type} must be either 'camera' or 'microphone'`)
2525
}
2626

27-
if (typeof callback !== 'function') {
28-
throw new TypeError(`callback must be a function`)
29-
}
30-
31-
return permissions.askForMediaAccess.call(this, type, callback)
27+
return permissions.askForMediaAccess.call(this, type)
3228
}
3329

3430
module.exports = {

test/module.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('node-mac-permissions', () => {
3535
describe('askForMediaAccess(type, callback)', () => {
3636
it ('throws on invalid media types', () => {
3737
expect(() => {
38-
askForMediaAccess('bad-type', (status) =>{
38+
askForMediaAccess('bad-type').then(status =>{
3939
console.log(status)
4040
})
4141
}).to.throw(/bad-type must be either 'camera' or 'microphone'/)

0 commit comments

Comments
 (0)