balena-supervisor/test/legacy/07-blink.spec.ts
Felipe Lalanne e1e35eb83b Move the current test suite under test/legacy
We are refactoring the supervisor test suite into unit tests (for
algorithms an domain model tests) and integration
tests (for interaction with out-of-process dependencies).
This means the current test suite needs to be classified into
these two categories, and fixed whenever possible.

This commit moves the test suite under the `test/legacy` folder, this
folder should be progressively migrated and eventually removed.
Subsequent commits will begin to split these files into unit and
integration whenever possible.

Depends-on: #1996
Change-type: patch
2022-08-22 17:21:51 -04:00

23 lines
712 B
TypeScript

import { promises as fs } from 'fs';
import { expect } from 'chai';
import blink = require('~/lib/blink');
import constants = require('~/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');
});
});