Skip to content

Commit

Permalink
chore: don't access CNContactStore in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Apr 19, 2020
1 parent 492cb49 commit 180d9dd
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
17 changes: 16 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"devDependencies": {
"chai": "^4.2.0",
"clang-format": "^1.3.0",
"is-ci": "^2.0.0",
"mocha": "^6.2.0",
"node-gyp": "^5.0.3",
"prettier": "^2.0.4"
Expand Down
12 changes: 8 additions & 4 deletions test/module.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ const {
listener,
} = require('../index')

const isCI = require('is-ci')
const ifit = (condition) => (condition ? it : it.skip)
const ifdescribe = (condition) => (condition ? describe : describe.skip)

describe('node-mac-contacts', () => {
describe('getAuthStatus()', () => {
it('should not throw', () => {
Expand Down Expand Up @@ -92,7 +96,7 @@ describe('node-mac-contacts', () => {
}).to.throw(/emailAddresses must be an array/)
})

it('should successfully add a contact', () => {
ifit(!isCI)('should successfully add a contact', () => {
const success = addNewContact({
firstName: 'William',
lastName: 'Grapeseed',
Expand Down Expand Up @@ -128,7 +132,7 @@ describe('node-mac-contacts', () => {
}).to.throw(errorMessage)
})

it('should retrieve a contact by name predicates', () => {
ifit(!isCI)('should retrieve a contact by name predicates', () => {
addNewContact({
firstName: 'Sherlock',
lastName: 'Holmes',
Expand Down Expand Up @@ -202,7 +206,7 @@ describe('node-mac-contacts', () => {
})
})

describe('listener', () => {
ifdescribe(!isCI)('listener', () => {
afterEach(() => {
if (listener.isListening()) {
listener.remove()
Expand All @@ -219,7 +223,7 @@ describe('node-mac-contacts', () => {
expect(() => {
listener.setup()
listener.setup()
}).to.throw(/An observer already observing/)
}).to.throw(/An observer is already observing/)
})

it('emits an event when the contact is changed', (done) => {
Expand Down

0 comments on commit 180d9dd

Please sign in to comment.