Create new tests for mocha and chai
This commit is contained in:
parent
11b389172c
commit
265f383f65
|
@ -0,0 +1,17 @@
|
|||
const assert = require('assert')
|
||||
|
||||
const delay = require('delay')
|
||||
|
||||
describe('delay module', async () => {
|
||||
it('should be a function', () =>{
|
||||
assert.equal(typeof delay, 'function')
|
||||
})
|
||||
|
||||
it('should pause a function for specified length in milliseconds', async () => {
|
||||
const delay1 = 1000;
|
||||
const start = +new Date()
|
||||
await delay(delay1)
|
||||
const res1 = +new Date() - start
|
||||
assert.ok(delay1 <= res1)
|
||||
})
|
||||
})
|
|
@ -0,0 +1,18 @@
|
|||
const assert = require('assert')
|
||||
|
||||
const settings = require('settings')
|
||||
|
||||
describe('settings module', async () => {
|
||||
it('should be an object', () =>{
|
||||
assert.equal(typeof settings, 'object')
|
||||
})
|
||||
it('should have a save method', () =>{
|
||||
assert.equal(typeof settings.save, 'function')
|
||||
})
|
||||
it('should have a restore method', () =>{
|
||||
assert.equal(typeof settings.restore, 'function')
|
||||
})
|
||||
it('should have a reset method', () =>{
|
||||
assert.equal(typeof settings.reset, 'function')
|
||||
})
|
||||
})
|
|
@ -0,0 +1,36 @@
|
|||
const assert = require('assert')
|
||||
|
||||
const system = require('system')
|
||||
let sys
|
||||
|
||||
describe('system module', async () => {
|
||||
it('should be a function', () =>{
|
||||
assert.equal(typeof system, 'function')
|
||||
})
|
||||
|
||||
it('should return an object', async () => {
|
||||
sys = await system()
|
||||
assert.equal(typeof sys, 'object')
|
||||
//console.dir(sys)
|
||||
})
|
||||
|
||||
it('should have a tmp property that is a string', () => {
|
||||
assert.notEqual(typeof sys.tmp, 'undefined')
|
||||
assert.equal(typeof sys.tmp, 'string')
|
||||
})
|
||||
it('should have a platform property that is a string that is nix, win or osx', () => {
|
||||
const choices = ['nix', 'win', 'osx']
|
||||
assert.notEqual(typeof sys.platform, 'undefined')
|
||||
assert.equal(typeof sys.platform, 'string')
|
||||
assert.ok(choices.indexOf(sys.platform) !== -1)
|
||||
})
|
||||
it('should have a deps property that is an object', () => {
|
||||
assert.notEqual(typeof sys.deps, 'undefined')
|
||||
assert.equal(typeof sys.deps, 'object')
|
||||
})
|
||||
|
||||
it('should have a displays property that is an array', () => {
|
||||
assert.notEqual(typeof sys.displays, 'undefined')
|
||||
assert.equal(typeof sys.displays, 'object')
|
||||
})
|
||||
})
|
File diff suppressed because it is too large
Load Diff
|
@ -8,7 +8,7 @@
|
|||
"lib": "lib"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "sh ./scripts/tests.sh",
|
||||
"test": "sh ./scripts/test.sh",
|
||||
"docs": "sh ./scripts/docs.sh",
|
||||
"build": "sh ./scripts/build.sh",
|
||||
"patch": "sh ./scripts/version.sh patch",
|
||||
|
@ -28,12 +28,10 @@
|
|||
"@types/electron": "^1.6.10",
|
||||
"@types/node": "^11.10.4",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"chai": "^4.2.0",
|
||||
"jsdoc-to-markdown": "^4.0.1",
|
||||
"mocha": "^6.1.3",
|
||||
"typescript": "^3.3.3333"
|
||||
},
|
||||
"dependencies" : {
|
||||
"dependencies": {
|
||||
"arduino": "file:lib/arduino",
|
||||
"cam": "file:lib/cam",
|
||||
"cmd": "file:lib/cmd",
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
(cd ./app && npm run test)
|
Loading…
Reference in New Issue