Skip to content

Commit

Permalink
test(index.spec.js): Added first real automated test of the toolsuite
Browse files Browse the repository at this point in the history
Added first jest backed test of the xpc-connect test suite. The purpose of this test is to validate
that the library is able to bind to the XPS Services Connection API exposed by Apple in each version
of Node and Xcode.
  • Loading branch information
jongear committed May 29, 2019
1 parent 16df290 commit e21d029
Show file tree
Hide file tree
Showing 6 changed files with 4,381 additions and 655 deletions.
37 changes: 37 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"rules": {
"max-len": 0,
"comma-dangle": 0,
"no-console": 0,
"padded-blocks": 0,
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"spaced-comment": 1,
"quotes": [
"error",
"single",
{
"allowTemplateLiterals": true
}
],
"import/prefer-default-export": "off",
"arrow-parens": 0,
"consistent-return": 0,
"no-useless-escape": 0,
"no-underscore-dangle": 0,
"no-undef": "error"
},
"extends": ["prettier"],
"plugins": ["prettier"],
"env": {
"browser": false,
"node": true,
"es6": true,
"jest": true
}
}
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ results

npm-debug.log

build/
node_modules/
build
node_modules

coverage

.vscode/ipch
30 changes: 30 additions & 0 deletions index.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const xpcConnect = require('./index');

test('test bluetooth connectivity', done => {
let bluedService = new xpcConnect('com.apple.blued');


bluedService.on('error', function(message) {
console.log('error: ' + JSON.stringify(message, undefined, 2));
});


bluedService.on('event', function(event) {
console.log('event: ' + JSON.stringify(event, undefined, 2));
});

bluedService.setup();

bluedService.sendMessage({
kCBMsgId: 1,
kCBMsgArgs: {
kCBMsgArgAlert: 1,
kCBMsgArgName: 'node'
}
});

setTimeout(function() {
bluedService.shutdown();
done();
}, 500);
});
Loading

0 comments on commit e21d029

Please sign in to comment.