Skip to content

Commit 5050097

Browse files
committed
spec: test extraProperties throws on bad array
1 parent 6c60668 commit 5050097

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/module.spec.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,31 @@ describe('node-mac-contacts', () => {
2020
})
2121
})
2222

23-
describe('getContactsByName(name)', () => {
23+
describe('getContactsByName(name[, extraProperties])', () => {
2424
it('should throw if name is not a string', () => {
2525
expect(() => {
2626
getContactsByName(12345)
2727
}).to.throw(/name must be a string/)
2828
})
29+
30+
it('should throw if extraProperties is not an array', () => {
31+
expect(() => {
32+
getContactsByName('jim-bob', 12345)
33+
}).to.throw(/extraProperties must be an array/)
34+
})
2935
})
3036

31-
describe('getAllContacts()', () => {
37+
describe('getAllContacts([extraProperties])', () => {
3238
it('should return an array', () => {
3339
const contacts = getAllContacts()
3440
expect(contacts).to.be.an('array')
3541
})
42+
43+
it('should throw if extraProperties is not an array', () => {
44+
expect(() => {
45+
getAllContacts('tsk-bad-array')
46+
}).to.throw(/extraProperties must be an array/)
47+
})
3648
})
3749

3850
describe('addNewContact(contact)', () => {

0 commit comments

Comments
 (0)