@homebridge-plugins/homebridge-plugin-update-check
Version:
A Homebridge plugin for checking for updates to Homebridge and plugins
75 lines • 2.94 kB
JavaScript
import { describe, expect, it } from 'vitest';
describe('pluginUpdatePlatformConfig', () => {
it('should allow valid platform name and identifier', () => {
const config = {
platform: 'ExamplePlatform',
};
expect(config.platform).toBe('ExamplePlatform');
});
it('should allow optional sensorType property', () => {
const config = {
platform: 'ExamplePlatform',
sensorType: 'temperature',
};
expect(config.sensorType).toBe('temperature');
});
it('should allow optional initialCheckDelay property', () => {
const config = {
platform: 'ExamplePlatform',
initialCheckDelay: 30,
};
expect(config.initialCheckDelay).toBe(30);
});
it('should allow all properties to be set', () => {
const config = {
platform: 'ExamplePlatform',
sensorType: 'humidity',
checkHomebridgeUpdates: true,
checkHomebridgeUIUpdates: true,
checkPluginUpdates: true,
checkDockerUpdates: true,
initialCheckDelay: 15,
autoUpdateHomebridge: true,
autoUpdateHomebridgeUI: false,
autoUpdatePlugins: true,
allowDirectNpmUpdates: false,
};
expect(config.platform).toBe('ExamplePlatform');
expect(config.sensorType).toBe('humidity');
expect(config.checkHomebridgeUpdates).toBe(true);
expect(config.checkHomebridgeUIUpdates).toBe(true);
expect(config.checkPluginUpdates).toBe(true);
expect(config.checkDockerUpdates).toBe(true);
expect(config.initialCheckDelay).toBe(15);
expect(config.autoUpdateHomebridge).toBe(true);
expect(config.autoUpdateHomebridgeUI).toBe(false);
expect(config.autoUpdatePlugins).toBe(true);
expect(config.allowDirectNpmUpdates).toBe(false);
});
it('should allow auto-update properties to be set independently', () => {
const config = {
platform: 'ExamplePlatform',
autoUpdateHomebridge: true,
autoUpdateHomebridgeUI: false,
autoUpdatePlugins: true,
};
expect(config.autoUpdateHomebridge).toBe(true);
expect(config.autoUpdateHomebridgeUI).toBe(false);
expect(config.autoUpdatePlugins).toBe(true);
});
it('should allow allowDirectNpmUpdates property to be set', () => {
const config = {
platform: 'ExamplePlatform',
allowDirectNpmUpdates: true,
};
expect(config.allowDirectNpmUpdates).toBe(true);
});
it('should allow autoRestartAfterUpdates property to be set', () => {
const config = {
platform: 'ExamplePlatform',
autoRestartAfterUpdates: true,
};
expect(config.autoRestartAfterUpdates).toBe(true);
});
});
//# sourceMappingURL=configTypes.test.js.map