mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-07-02 10:01:37 +00:00
bb6c226d55
* Add missing `zcl-id` dependency * Improve devicePublish test Now passes in both mocha and jest Each test now waits for all publishes, such as readbacks, and asserts their number. Replaced `calledOnce` and such with numeric assertion, for a more informative error message. * Use sinon default sandbox * Take assert out of chai Improves clutter, but also `jest-codemods` also makes use of this. * Replace proxyquire with simple cache delete * Reduce shared mutable state in settings.test
24 lines
821 B
JavaScript
24 lines
821 B
JavaScript
const assert = require('chai').assert;
|
|
const data = require('../lib/util/data.js');
|
|
const path = require('path');
|
|
|
|
describe('Data', () => {
|
|
describe('Get path', () => {
|
|
it('Should return correct path', () => {
|
|
const expected = path.normalize(path.join(__dirname, '..', 'data'));
|
|
const actual = data.getPath();
|
|
assert.strictEqual(actual, expected);
|
|
});
|
|
|
|
it('Should return correct path when ZIGBEE2MQTT_DATA set', () => {
|
|
const expected = path.join('var', 'zigbee2mqtt');
|
|
process.env.ZIGBEE2MQTT_DATA = expected;
|
|
data._reload();
|
|
const actual = data.getPath();
|
|
assert.strictEqual(actual, expected);
|
|
delete process.env.ZIGBEE2MQTT_DATA;
|
|
data._reload();
|
|
});
|
|
});
|
|
});
|