Skip to content

Commit

Permalink
feat: started working on integration tests, added a client-side stub
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Mar 3, 2018
1 parent 794b5be commit c4cbadc
Show file tree
Hide file tree
Showing 3 changed files with 105 additions and 6 deletions.
34 changes: 34 additions & 0 deletions meteor.coverage.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"include": [
],
"exclude": {
"general": [],
"server": [
"**/node_modules/**/*.json",
"**/.!(meteor)*/**",
"**/packages/!(local-test_?*.js)",
"**/+([^:]):+([^:])/**",
"**/@(test|tests|spec|specs)/**",
"**/?(*.)test?(s).?*",
"**/?(*.)spec?(s).?*",
"**/?(*.)app-test?(s).?*",
"**/?(*.)app-spec?(s).?*"
],
"client": [
"**/*.json",
"**/client/stylesheets/**",
"**/.npm/package/node_modules/**",
"**/web.browser/packages/**",
"**/.?*/**",
"**/packages/!(local-test_?*.js)",
"**/+([^:]):+([^:])/**",
"**/@(test|tests|spec|specs)/**",
"**/?(*.)test?(s).?*",
"**/?(*.)spec?(s).?*",
"**/?(*.)app-test?(s).?*",
"**/?(*.)app-spec?(s).?*"
]
},
"remapFormat": ["html", "cobertura", "clover", "json", "json-summary", "lcovonly", "teamcity", "text", "text-summary"],
"output": "./.coverage"
}
58 changes: 58 additions & 0 deletions meteor/client/__tests__/peripheralDevice.app-test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/* Integration test for peripheralDevice */


import * as chai from 'chai';
import { Random } from 'meteor/random';
import {} from 'mocha';

import { PeripheralDevices } from '../../lib/collections/PeripheralDevices';
//import { ServerPeripheralDeviceAPI } from '../peripheralDevice';
import { PeripheralDeviceAPI } from '../../lib/api/peripheralDevice';

import {getCurrentTime} from '../../lib/lib';

const expect = chai.expect;





describe('Access to peripheralDevice API', function () {
beforeEach(function() {
//console.log('Logout');
});
afterEach(function() {
//console.log('Logout');
});
/*
it('peripheralDevice.setStatus()', async function () {
var deviceId = Random.id();
var token = Random.id();
var returnedId = await PeripheralDeviceAPI.init(deviceId, token);
var returnedStatus = await PeripheralDeviceAPI.setStatus(deviceId, {
statusCode: PeripheralDeviceAPI.StatusCode.GOOD,
messages: ["It's all good"]
});
// check that there is an object
var md = PeripheralDevices.findOne(deviceId);
expect(md).to.be.an('object');
expect(md.status).to.be.an('object');
expect(md.status.statusCode).to.be.equal(PeripheralDeviceAPI.StatusCode.GOOD);
expect(md.status.messages).to.have.length(1);
// clear up after ourselves:
});
*/

})
19 changes: 13 additions & 6 deletions meteor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@
"private": true,
"scripts": {
"start": "meteor run",
"test": "npm run test-watch",
"test-watch": "TEST_WATCH=1 meteor test --driver-package meteortesting:mocha",
"test": "npm run unit-test",
"test-i": "npm run integration-test",
"unit-test": "TEST_WATCH=1 meteor test --driver-package meteortesting:mocha",
"integration-test": "TEST_WATCH=1 meteor test --full-app --driver-package meteortesting:mocha",

"test-once": "meteor test --once --driver-package meteortesting:mocha"
},
"dependencies": {
"@babel/runtime": "^7.0.0-beta.36",
"@types/meteor": "^1.4.13",
"@types/node": "^9.4.6",
"@types/react": "^16.0.40",
"@types/react-dom": "^16.0.4",
"chai": "^4.1.2",
"core-js": "^2.5.3",
"meteor-node-stubs": "^0.3.2",
Expand All @@ -21,5 +20,13 @@
"react-dom": "^16.2.0",
"react-hotkeys": "^0.10.0",
"react-router-dom": "^4.2.2"
},
"devDependencies": {
"@types/meteor": "^1.4.13",
"@types/node": "^9.4.6",
"@types/react": "^16.0.40",
"@types/react-dom": "^16.0.4",
"@types/chai": "^4.1.2",
"@types/mocha": "^2.2.48"
}
}

0 comments on commit c4cbadc

Please sign in to comment.