mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2024-12-22 23:12:23 +00:00
4a2ac557ef
'mz' can be safely replaced with fs.promises and util.promisify for faster native methods. 'mkdirp' after Node v8 uses native fs.mkdir, thus is redundant. 'body-parser' is deprecated and contained within express v4.x. Closes: #1567 Change-type: patch Signed-off-by: Christina Wang <christina@balena.io>
23 lines
722 B
TypeScript
23 lines
722 B
TypeScript
import { promises as fs } from 'fs';
|
|
import { expect } from 'chai';
|
|
|
|
import blink = require('../src/lib/blink');
|
|
import constants = require('../src/lib/constants');
|
|
|
|
describe('blink', () => {
|
|
it('is a blink function', () => expect(blink).to.be.a('function'));
|
|
|
|
it('has a pattern property with start and stop functions', () => {
|
|
expect(blink.pattern.start).to.be.a('function');
|
|
expect(blink.pattern.stop).to.be.a('function');
|
|
});
|
|
|
|
it('writes to a file that represents the LED, and writes a 0 at the end to turn the LED off', async () => {
|
|
// TODO: Fix the typings for blink
|
|
await (blink as any)(1);
|
|
const contents = await fs.readFile(constants.ledFile);
|
|
|
|
expect(contents.toString()).to.equal('0');
|
|
});
|
|
});
|