2020-03-31 15:46:04 +00:00
|
|
|
import { expect } from './lib/chai-config';
|
|
|
|
import * as configUtils from '../src/config/utils';
|
2020-08-07 17:34:32 +00:00
|
|
|
import { ConfigTxt } from '../src/config/backends/config-txt';
|
2020-03-31 15:46:04 +00:00
|
|
|
|
2020-08-07 17:34:32 +00:00
|
|
|
const configTxtBackend = new ConfigTxt();
|
2020-03-31 15:46:04 +00:00
|
|
|
|
2020-06-10 18:50:26 +00:00
|
|
|
describe('Config Utilities', () => {
|
|
|
|
describe('Boot config', () => {
|
|
|
|
it('correctly transforms environments to boot config objects', () => {
|
2020-08-07 17:34:32 +00:00
|
|
|
const bootConfig = configUtils.envToBootConfig(configTxtBackend, {
|
2020-06-10 18:50:26 +00:00
|
|
|
HOST_CONFIG_initramfs: 'initramf.gz 0x00800000',
|
|
|
|
HOST_CONFIG_dtparam: '"i2c=on","audio=on"',
|
|
|
|
HOST_CONFIG_dtoverlay:
|
|
|
|
'"ads7846","lirc-rpi,gpio_out_pin=17,gpio_in_pin=13"',
|
|
|
|
HOST_CONFIG_foobar: 'baz',
|
2020-03-31 15:46:04 +00:00
|
|
|
});
|
2020-06-10 18:50:26 +00:00
|
|
|
expect(bootConfig).to.deep.equal({
|
|
|
|
initramfs: 'initramf.gz 0x00800000',
|
|
|
|
dtparam: ['i2c=on', 'audio=on'],
|
|
|
|
dtoverlay: ['ads7846', 'lirc-rpi,gpio_out_pin=17,gpio_in_pin=13'],
|
|
|
|
foobar: 'baz',
|
2020-03-31 15:46:04 +00:00
|
|
|
});
|
|
|
|
});
|
2020-06-10 18:50:26 +00:00
|
|
|
});
|
|
|
|
});
|