mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2024-11-16 02:18:31 -07:00
09383877b0
* Update dependencies * Fix lint Co-authored-by: Koenkk <Koenkk@users.noreply.github.com> Co-authored-by: Koen Kanters <koenkanters94@gmail.com>
27 lines
961 B
JavaScript
27 lines
961 B
JavaScript
const logger = require('./stub/logger');
|
|
const data = require('../lib/util/data').default;
|
|
const path = require('path');
|
|
const tmp = require('tmp');
|
|
const fs = require('fs');
|
|
|
|
describe('Data', () => {
|
|
describe('Get path', () => {
|
|
it('Should return correct path', () => {
|
|
const expected = path.normalize(path.join(__dirname, '..', 'data'));
|
|
const actual = data.getPath();
|
|
expect(actual).toBe(expected);
|
|
});
|
|
|
|
it('Should return correct path when ZIGBEE2MQTT_DATA set', () => {
|
|
const expected = tmp.dirSync().name;
|
|
process.env.ZIGBEE2MQTT_DATA = expected;
|
|
data.testingOnlyReload();
|
|
const actual = data.getPath();
|
|
expect(actual).toBe(expected);
|
|
expect(data.joinPath('test')).toStrictEqual(path.join(expected, 'test'));
|
|
delete process.env.ZIGBEE2MQTT_DATA;
|
|
data.testingOnlyReload();
|
|
});
|
|
});
|
|
});
|