refactor: adopt POSITIONS constants, fix ESLint warnings, break menuUtils into modules
- Replace hardcoded position strings with POSITIONS.* constants - Prefix unused variables with _ to resolve no-unused-vars warnings - Fix no-prototype-builtins with Object.prototype.hasOwnProperty.call() - Extract menuUtils.js (543 lines) into 6 focused modules under menu/ - menuUtils.js now 35 lines, delegates via prototype mixin pattern - Add 158 unit tests for ConfigManager, MeasurementContainer, ValidationUtils Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
196
test/configManager.test.js
Normal file
196
test/configManager.test.js
Normal file
@@ -0,0 +1,196 @@
|
||||
const path = require('path');
|
||||
const ConfigManager = require('../src/configs/index');
|
||||
|
||||
describe('ConfigManager', () => {
|
||||
const configDir = path.resolve(__dirname, '../src/configs');
|
||||
let cm;
|
||||
|
||||
beforeEach(() => {
|
||||
cm = new ConfigManager(configDir);
|
||||
});
|
||||
|
||||
// ── getConfig() ──────────────────────────────────────────────────────
|
||||
describe('getConfig()', () => {
|
||||
it('should load and parse a known JSON config file', () => {
|
||||
const config = cm.getConfig('baseConfig');
|
||||
expect(config).toBeDefined();
|
||||
expect(typeof config).toBe('object');
|
||||
});
|
||||
|
||||
it('should return the same content on successive calls', () => {
|
||||
const a = cm.getConfig('baseConfig');
|
||||
const b = cm.getConfig('baseConfig');
|
||||
expect(a).toEqual(b);
|
||||
});
|
||||
|
||||
it('should throw when the config file does not exist', () => {
|
||||
expect(() => cm.getConfig('nonExistentConfig_xyz'))
|
||||
.toThrow(/Failed to load config/);
|
||||
});
|
||||
|
||||
it('should throw a descriptive message including the config name', () => {
|
||||
expect(() => cm.getConfig('missing'))
|
||||
.toThrow("Failed to load config 'missing'");
|
||||
});
|
||||
});
|
||||
|
||||
// ── hasConfig() ──────────────────────────────────────────────────────
|
||||
describe('hasConfig()', () => {
|
||||
it('should return true for a config that exists', () => {
|
||||
expect(cm.hasConfig('baseConfig')).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for a config that does not exist', () => {
|
||||
expect(cm.hasConfig('doesNotExist_abc')).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ── getAvailableConfigs() ────────────────────────────────────────────
|
||||
describe('getAvailableConfigs()', () => {
|
||||
it('should return an array of strings', () => {
|
||||
const configs = cm.getAvailableConfigs();
|
||||
expect(Array.isArray(configs)).toBe(true);
|
||||
configs.forEach(name => expect(typeof name).toBe('string'));
|
||||
});
|
||||
|
||||
it('should include known config names without .json extension', () => {
|
||||
const configs = cm.getAvailableConfigs();
|
||||
expect(configs).toContain('baseConfig');
|
||||
expect(configs).toContain('measurement');
|
||||
});
|
||||
|
||||
it('should not include .json extension in returned names', () => {
|
||||
const configs = cm.getAvailableConfigs();
|
||||
configs.forEach(name => {
|
||||
expect(name).not.toMatch(/\.json$/);
|
||||
});
|
||||
});
|
||||
|
||||
it('should throw when pointed at a non-existent directory', () => {
|
||||
const bad = new ConfigManager('/tmp/nonexistent_dir_xyz_123');
|
||||
expect(() => bad.getAvailableConfigs()).toThrow(/Failed to read config directory/);
|
||||
});
|
||||
});
|
||||
|
||||
// ── buildConfig() ────────────────────────────────────────────────────
|
||||
describe('buildConfig()', () => {
|
||||
it('should return an object with general and functionality sections', () => {
|
||||
const uiConfig = { name: 'TestNode', unit: 'bar', enableLog: true, logLevel: 'debug' };
|
||||
const result = cm.buildConfig('measurement', uiConfig, 'node-id-1');
|
||||
expect(result).toHaveProperty('general');
|
||||
expect(result).toHaveProperty('functionality');
|
||||
});
|
||||
|
||||
it('should populate general.name from uiConfig.name', () => {
|
||||
const uiConfig = { name: 'MySensor' };
|
||||
const result = cm.buildConfig('measurement', uiConfig, 'id-1');
|
||||
expect(result.general.name).toBe('MySensor');
|
||||
});
|
||||
|
||||
it('should default general.name to nodeName when uiConfig.name is empty', () => {
|
||||
const result = cm.buildConfig('measurement', {}, 'id-1');
|
||||
expect(result.general.name).toBe('measurement');
|
||||
});
|
||||
|
||||
it('should set general.id from the nodeId argument', () => {
|
||||
const result = cm.buildConfig('valve', {}, 'node-42');
|
||||
expect(result.general.id).toBe('node-42');
|
||||
});
|
||||
|
||||
it('should default unit to unitless', () => {
|
||||
const result = cm.buildConfig('valve', {}, 'id-1');
|
||||
expect(result.general.unit).toBe('unitless');
|
||||
});
|
||||
|
||||
it('should default logging.enabled to true when enableLog is undefined', () => {
|
||||
const result = cm.buildConfig('valve', {}, 'id-1');
|
||||
expect(result.general.logging.enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('should respect enableLog = false', () => {
|
||||
const result = cm.buildConfig('valve', { enableLog: false }, 'id-1');
|
||||
expect(result.general.logging.enabled).toBe(false);
|
||||
});
|
||||
|
||||
it('should default logLevel to info', () => {
|
||||
const result = cm.buildConfig('valve', {}, 'id-1');
|
||||
expect(result.general.logging.logLevel).toBe('info');
|
||||
});
|
||||
|
||||
it('should set functionality.softwareType to lowercase nodeName', () => {
|
||||
const result = cm.buildConfig('Valve', {}, 'id-1');
|
||||
expect(result.functionality.softwareType).toBe('valve');
|
||||
});
|
||||
|
||||
it('should default positionVsParent to atEquipment', () => {
|
||||
const result = cm.buildConfig('valve', {}, 'id-1');
|
||||
expect(result.functionality.positionVsParent).toBe('atEquipment');
|
||||
});
|
||||
|
||||
it('should set distance when hasDistance is true', () => {
|
||||
const result = cm.buildConfig('valve', { hasDistance: true, distance: 5.5 }, 'id-1');
|
||||
expect(result.functionality.distance).toBe(5.5);
|
||||
});
|
||||
|
||||
it('should set distance to undefined when hasDistance is false', () => {
|
||||
const result = cm.buildConfig('valve', { hasDistance: false, distance: 5.5 }, 'id-1');
|
||||
expect(result.functionality.distance).toBeUndefined();
|
||||
});
|
||||
|
||||
// ── asset section ──────────────────────────────────────────────────
|
||||
it('should not include asset section when no asset fields provided', () => {
|
||||
const result = cm.buildConfig('valve', {}, 'id-1');
|
||||
expect(result.asset).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should include asset section when supplier is provided', () => {
|
||||
const result = cm.buildConfig('valve', { supplier: 'Siemens' }, 'id-1');
|
||||
expect(result.asset).toBeDefined();
|
||||
expect(result.asset.supplier).toBe('Siemens');
|
||||
});
|
||||
|
||||
it('should populate asset defaults for missing optional fields', () => {
|
||||
const result = cm.buildConfig('valve', { supplier: 'ABB' }, 'id-1');
|
||||
expect(result.asset.category).toBe('sensor');
|
||||
expect(result.asset.type).toBe('Unknown');
|
||||
expect(result.asset.model).toBe('Unknown');
|
||||
});
|
||||
|
||||
// ── domainConfig merge ─────────────────────────────────────────────
|
||||
it('should merge domainConfig sections into the result', () => {
|
||||
const domain = { scaling: { enabled: true, factor: 2 } };
|
||||
const result = cm.buildConfig('measurement', {}, 'id-1', domain);
|
||||
expect(result.scaling).toEqual({ enabled: true, factor: 2 });
|
||||
});
|
||||
|
||||
it('should handle empty domainConfig gracefully', () => {
|
||||
const result = cm.buildConfig('measurement', {}, 'id-1', {});
|
||||
expect(result).toHaveProperty('general');
|
||||
expect(result).toHaveProperty('functionality');
|
||||
});
|
||||
});
|
||||
|
||||
// ── createEndpoint() ─────────────────────────────────────────────────
|
||||
describe('createEndpoint()', () => {
|
||||
it('should return a JavaScript string containing the node name', () => {
|
||||
const script = cm.createEndpoint('baseConfig');
|
||||
expect(typeof script).toBe('string');
|
||||
expect(script).toContain('baseConfig');
|
||||
expect(script).toContain('window.EVOLV');
|
||||
});
|
||||
|
||||
it('should throw for a non-existent config', () => {
|
||||
expect(() => cm.createEndpoint('doesNotExist_xyz'))
|
||||
.toThrow(/Failed to create endpoint/);
|
||||
});
|
||||
});
|
||||
|
||||
// ── getBaseConfig() ──────────────────────────────────────────────────
|
||||
describe('getBaseConfig()', () => {
|
||||
it('should load the baseConfig.json file', () => {
|
||||
const base = cm.getBaseConfig();
|
||||
expect(base).toBeDefined();
|
||||
expect(typeof base).toBe('object');
|
||||
});
|
||||
});
|
||||
});
|
||||
336
test/measurementContainer.test.js
Normal file
336
test/measurementContainer.test.js
Normal file
@@ -0,0 +1,336 @@
|
||||
const MeasurementContainer = require('../src/measurements/MeasurementContainer');
|
||||
|
||||
describe('MeasurementContainer', () => {
|
||||
let mc;
|
||||
|
||||
beforeEach(() => {
|
||||
mc = new MeasurementContainer({ windowSize: 5, autoConvert: false });
|
||||
});
|
||||
|
||||
// ── Construction ─────────────────────────────────────────────────────
|
||||
describe('constructor', () => {
|
||||
it('should initialise with default windowSize when none provided', () => {
|
||||
const m = new MeasurementContainer();
|
||||
expect(m.windowSize).toBe(10);
|
||||
});
|
||||
|
||||
it('should accept a custom windowSize', () => {
|
||||
expect(mc.windowSize).toBe(5);
|
||||
});
|
||||
|
||||
it('should start with an empty measurements map', () => {
|
||||
expect(mc.measurements).toEqual({});
|
||||
});
|
||||
|
||||
it('should populate default units', () => {
|
||||
expect(mc.defaultUnits.pressure).toBe('mbar');
|
||||
expect(mc.defaultUnits.flow).toBe('m3/h');
|
||||
});
|
||||
|
||||
it('should allow overriding default units', () => {
|
||||
const m = new MeasurementContainer({ defaultUnits: { pressure: 'Pa' } });
|
||||
expect(m.defaultUnits.pressure).toBe('Pa');
|
||||
});
|
||||
});
|
||||
|
||||
// ── Chainable setters ───────────────────────────────────────────────
|
||||
describe('chaining API — type / variant / position', () => {
|
||||
it('should set type and return this for chaining', () => {
|
||||
const ret = mc.type('pressure');
|
||||
expect(ret).toBe(mc);
|
||||
expect(mc._currentType).toBe('pressure');
|
||||
});
|
||||
|
||||
it('should reset variant and position when type is called', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
mc.type('flow');
|
||||
expect(mc._currentVariant).toBeNull();
|
||||
expect(mc._currentPosition).toBeNull();
|
||||
});
|
||||
|
||||
it('should set variant and return this', () => {
|
||||
mc.type('pressure');
|
||||
const ret = mc.variant('measured');
|
||||
expect(ret).toBe(mc);
|
||||
expect(mc._currentVariant).toBe('measured');
|
||||
});
|
||||
|
||||
it('should throw if variant is called without type', () => {
|
||||
expect(() => mc.variant('measured')).toThrow(/Type must be specified/);
|
||||
});
|
||||
|
||||
it('should set position (lowercased) and return this', () => {
|
||||
mc.type('pressure').variant('measured');
|
||||
const ret = mc.position('Upstream');
|
||||
expect(ret).toBe(mc);
|
||||
expect(mc._currentPosition).toBe('upstream');
|
||||
});
|
||||
|
||||
it('should throw if position is called without variant', () => {
|
||||
mc.type('pressure');
|
||||
expect(() => mc.position('upstream')).toThrow(/Variant must be specified/);
|
||||
});
|
||||
});
|
||||
|
||||
// ── Storing and retrieving values ───────────────────────────────────
|
||||
describe('value() and retrieval methods', () => {
|
||||
beforeEach(() => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
});
|
||||
|
||||
it('should store a value and retrieve it with getCurrentValue()', () => {
|
||||
mc.value(42, 1000);
|
||||
expect(mc.getCurrentValue()).toBe(42);
|
||||
});
|
||||
|
||||
it('should return this for chaining from value()', () => {
|
||||
const ret = mc.value(1, 1000);
|
||||
expect(ret).toBe(mc);
|
||||
});
|
||||
|
||||
it('should store multiple values and keep the latest', () => {
|
||||
mc.value(10, 1).value(20, 2).value(30, 3);
|
||||
expect(mc.getCurrentValue()).toBe(30);
|
||||
});
|
||||
|
||||
it('should respect the windowSize (rolling window)', () => {
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
mc.value(i, i);
|
||||
}
|
||||
const all = mc.getAllValues();
|
||||
// windowSize is 5, so only the last 5 values should remain
|
||||
expect(all.values.length).toBe(5);
|
||||
expect(all.values).toEqual([4, 5, 6, 7, 8]);
|
||||
});
|
||||
|
||||
it('should compute getAverage() correctly', () => {
|
||||
mc.value(10, 1).value(20, 2).value(30, 3);
|
||||
expect(mc.getAverage()).toBe(20);
|
||||
});
|
||||
|
||||
it('should compute getMin()', () => {
|
||||
mc.value(10, 1).value(5, 2).value(20, 3);
|
||||
expect(mc.getMin()).toBe(5);
|
||||
});
|
||||
|
||||
it('should compute getMax()', () => {
|
||||
mc.value(10, 1).value(5, 2).value(20, 3);
|
||||
expect(mc.getMax()).toBe(20);
|
||||
});
|
||||
|
||||
it('should return null for getCurrentValue() when no values exist', () => {
|
||||
expect(mc.getCurrentValue()).toBeNull();
|
||||
});
|
||||
|
||||
it('should return null for getAverage() when no values exist', () => {
|
||||
expect(mc.getAverage()).toBeNull();
|
||||
});
|
||||
|
||||
it('should return null for getMin() when no values exist', () => {
|
||||
expect(mc.getMin()).toBeNull();
|
||||
});
|
||||
|
||||
it('should return null for getMax() when no values exist', () => {
|
||||
expect(mc.getMax()).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
// ── getAllValues() ──────────────────────────────────────────────────
|
||||
describe('getAllValues()', () => {
|
||||
it('should return values, timestamps, and unit', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
mc.unit('bar');
|
||||
mc.value(10, 100).value(20, 200);
|
||||
const all = mc.getAllValues();
|
||||
expect(all.values).toEqual([10, 20]);
|
||||
expect(all.timestamps).toEqual([100, 200]);
|
||||
expect(all.unit).toBe('bar');
|
||||
});
|
||||
|
||||
it('should return null when chain is incomplete', () => {
|
||||
mc.type('pressure');
|
||||
expect(mc.getAllValues()).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
// ── unit() ──────────────────────────────────────────────────────────
|
||||
describe('unit()', () => {
|
||||
it('should set unit on the underlying measurement', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
mc.unit('bar');
|
||||
const measurement = mc.get();
|
||||
expect(measurement.unit).toBe('bar');
|
||||
});
|
||||
});
|
||||
|
||||
// ── get() ───────────────────────────────────────────────────────────
|
||||
describe('get()', () => {
|
||||
it('should return the Measurement instance for a complete chain', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
mc.value(1, 1);
|
||||
const m = mc.get();
|
||||
expect(m).toBeDefined();
|
||||
expect(m.type).toBe('pressure');
|
||||
expect(m.variant).toBe('measured');
|
||||
expect(m.position).toBe('upstream');
|
||||
});
|
||||
|
||||
it('should return null when chain is incomplete', () => {
|
||||
mc.type('pressure');
|
||||
expect(mc.get()).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
// ── exists() ────────────────────────────────────────────────────────
|
||||
describe('exists()', () => {
|
||||
it('should return false for a non-existent measurement', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
expect(mc.exists()).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true after a value has been stored', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream').value(1, 1);
|
||||
expect(mc.exists()).toBe(true);
|
||||
});
|
||||
|
||||
it('should support requireValues option', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
// Force creation of measurement without values
|
||||
mc.get();
|
||||
expect(mc.exists({ requireValues: false })).toBe(true);
|
||||
expect(mc.exists({ requireValues: true })).toBe(false);
|
||||
});
|
||||
|
||||
it('should support explicit type/variant/position overrides', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream').value(1, 1);
|
||||
// Reset chain, then query by explicit keys
|
||||
mc.type('flow');
|
||||
expect(mc.exists({ type: 'pressure', variant: 'measured', position: 'upstream' })).toBe(true);
|
||||
expect(mc.exists({ type: 'flow', variant: 'measured', position: 'upstream' })).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false when type is not set and not provided', () => {
|
||||
const fresh = new MeasurementContainer({ autoConvert: false });
|
||||
expect(fresh.exists()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ── getLaggedValue() / getLaggedSample() ─────────────────────────────
|
||||
describe('getLaggedValue() and getLaggedSample()', () => {
|
||||
beforeEach(() => {
|
||||
mc.type('pressure').variant('measured').position('upstream');
|
||||
mc.value(10, 100).value(20, 200).value(30, 300);
|
||||
});
|
||||
|
||||
it('should return the value at lag=1 (previous value)', () => {
|
||||
expect(mc.getLaggedValue(1)).toBe(20);
|
||||
});
|
||||
|
||||
it('should return null when lag exceeds stored values', () => {
|
||||
expect(mc.getLaggedValue(10)).toBeNull();
|
||||
});
|
||||
|
||||
it('should return a sample object from getLaggedSample()', () => {
|
||||
const sample = mc.getLaggedSample(0);
|
||||
expect(sample).toHaveProperty('value', 30);
|
||||
expect(sample).toHaveProperty('timestamp', 300);
|
||||
});
|
||||
|
||||
it('should return null from getLaggedSample when not enough values', () => {
|
||||
expect(mc.getLaggedSample(10)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
// ── Listing helpers ─────────────────────────────────────────────────
|
||||
describe('getTypes() / getVariants() / getPositions()', () => {
|
||||
beforeEach(() => {
|
||||
mc.type('pressure').variant('measured').position('upstream').value(1, 1);
|
||||
mc.type('flow').variant('predicted').position('downstream').value(2, 2);
|
||||
});
|
||||
|
||||
it('should list all stored types', () => {
|
||||
const types = mc.getTypes();
|
||||
expect(types).toContain('pressure');
|
||||
expect(types).toContain('flow');
|
||||
});
|
||||
|
||||
it('should list variants for a given type', () => {
|
||||
mc.type('pressure');
|
||||
expect(mc.getVariants()).toContain('measured');
|
||||
});
|
||||
|
||||
it('should return empty array for type with no variants', () => {
|
||||
mc.type('temperature');
|
||||
expect(mc.getVariants()).toEqual([]);
|
||||
});
|
||||
|
||||
it('should throw if getVariants() called without type', () => {
|
||||
const fresh = new MeasurementContainer({ autoConvert: false });
|
||||
expect(() => fresh.getVariants()).toThrow(/Type must be specified/);
|
||||
});
|
||||
|
||||
it('should list positions for type+variant', () => {
|
||||
mc.type('pressure').variant('measured');
|
||||
expect(mc.getPositions()).toContain('upstream');
|
||||
});
|
||||
|
||||
it('should throw if getPositions() called without type and variant', () => {
|
||||
const fresh = new MeasurementContainer({ autoConvert: false });
|
||||
expect(() => fresh.getPositions()).toThrow(/Type and variant must be specified/);
|
||||
});
|
||||
});
|
||||
|
||||
// ── clear() ─────────────────────────────────────────────────────────
|
||||
describe('clear()', () => {
|
||||
it('should reset all measurements and chain state', () => {
|
||||
mc.type('pressure').variant('measured').position('upstream').value(1, 1);
|
||||
mc.clear();
|
||||
expect(mc.measurements).toEqual({});
|
||||
expect(mc._currentType).toBeNull();
|
||||
expect(mc._currentVariant).toBeNull();
|
||||
expect(mc._currentPosition).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
// ── Child context setters ───────────────────────────────────────────
|
||||
describe('child context', () => {
|
||||
it('should set childId and return this', () => {
|
||||
expect(mc.setChildId('c1')).toBe(mc);
|
||||
expect(mc.childId).toBe('c1');
|
||||
});
|
||||
|
||||
it('should set childName and return this', () => {
|
||||
expect(mc.setChildName('pump1')).toBe(mc);
|
||||
expect(mc.childName).toBe('pump1');
|
||||
});
|
||||
|
||||
it('should set parentRef and return this', () => {
|
||||
const parent = { id: 'p1' };
|
||||
expect(mc.setParentRef(parent)).toBe(mc);
|
||||
expect(mc.parentRef).toBe(parent);
|
||||
});
|
||||
});
|
||||
|
||||
// ── Event emission ──────────────────────────────────────────────────
|
||||
describe('event emission', () => {
|
||||
it('should emit an event when a value is set', (done) => {
|
||||
mc.emitter.on('pressure.measured.upstream', (data) => {
|
||||
expect(data.value).toBe(42);
|
||||
expect(data.type).toBe('pressure');
|
||||
expect(data.variant).toBe('measured');
|
||||
expect(data.position).toBe('upstream');
|
||||
done();
|
||||
});
|
||||
mc.type('pressure').variant('measured').position('upstream').value(42, 1);
|
||||
});
|
||||
});
|
||||
|
||||
// ── setPreferredUnit ────────────────────────────────────────────────
|
||||
describe('setPreferredUnit()', () => {
|
||||
it('should store preferred unit and return this', () => {
|
||||
const ret = mc.setPreferredUnit('pressure', 'Pa');
|
||||
expect(ret).toBe(mc);
|
||||
expect(mc.preferredUnits.pressure).toBe('Pa');
|
||||
});
|
||||
});
|
||||
});
|
||||
554
test/validationUtils.test.js
Normal file
554
test/validationUtils.test.js
Normal file
@@ -0,0 +1,554 @@
|
||||
const ValidationUtils = require('../src/helper/validationUtils');
|
||||
const { validateNumber, validateInteger, validateBoolean, validateString, validateEnum } = require('../src/helper/validators/typeValidators');
|
||||
const { validateArray, validateSet, validateObject } = require('../src/helper/validators/collectionValidators');
|
||||
const { validateCurve, validateMachineCurve, isSorted, isUnique, areNumbers } = require('../src/helper/validators/curveValidator');
|
||||
|
||||
// Shared mock logger used across tests
|
||||
function mockLogger() {
|
||||
return { debug: jest.fn(), info: jest.fn(), warn: jest.fn(), error: jest.fn() };
|
||||
}
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// Type validators
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
describe('typeValidators', () => {
|
||||
let logger;
|
||||
beforeEach(() => { logger = mockLogger(); });
|
||||
|
||||
// ── validateNumber ──────────────────────────────────────────────────
|
||||
describe('validateNumber()', () => {
|
||||
it('should accept a valid number', () => {
|
||||
expect(validateNumber(42, {}, { default: 0 }, 'n', 'k', logger)).toBe(42);
|
||||
});
|
||||
|
||||
it('should parse a string to a number', () => {
|
||||
expect(validateNumber('3.14', {}, { default: 0 }, 'n', 'k', logger)).toBe(3.14);
|
||||
expect(logger.warn).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('should return default when below min', () => {
|
||||
expect(validateNumber(1, { min: 5 }, { default: 5 }, 'n', 'k', logger)).toBe(5);
|
||||
});
|
||||
|
||||
it('should return default when above max', () => {
|
||||
expect(validateNumber(100, { max: 50 }, { default: 50 }, 'n', 'k', logger)).toBe(50);
|
||||
});
|
||||
|
||||
it('should accept boundary value equal to min', () => {
|
||||
expect(validateNumber(5, { min: 5 }, { default: 0 }, 'n', 'k', logger)).toBe(5);
|
||||
});
|
||||
|
||||
it('should accept boundary value equal to max', () => {
|
||||
expect(validateNumber(50, { max: 50 }, { default: 0 }, 'n', 'k', logger)).toBe(50);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateInteger ─────────────────────────────────────────────────
|
||||
describe('validateInteger()', () => {
|
||||
it('should accept a valid integer', () => {
|
||||
expect(validateInteger(7, {}, { default: 0 }, 'n', 'k', logger)).toBe(7);
|
||||
});
|
||||
|
||||
it('should parse a string to an integer', () => {
|
||||
expect(validateInteger('10', {}, { default: 0 }, 'n', 'k', logger)).toBe(10);
|
||||
});
|
||||
|
||||
it('should return default for a non-parseable value', () => {
|
||||
expect(validateInteger('abc', {}, { default: -1 }, 'n', 'k', logger)).toBe(-1);
|
||||
});
|
||||
|
||||
it('should return default when below min', () => {
|
||||
expect(validateInteger(2, { min: 5 }, { default: 5 }, 'n', 'k', logger)).toBe(5);
|
||||
});
|
||||
|
||||
it('should return default when above max', () => {
|
||||
expect(validateInteger(100, { max: 50 }, { default: 50 }, 'n', 'k', logger)).toBe(50);
|
||||
});
|
||||
|
||||
it('should parse a float string and truncate to integer', () => {
|
||||
expect(validateInteger('7.9', {}, { default: 0 }, 'n', 'k', logger)).toBe(7);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateBoolean ─────────────────────────────────────────────────
|
||||
describe('validateBoolean()', () => {
|
||||
it('should pass through a true boolean', () => {
|
||||
expect(validateBoolean(true, 'n', 'k', logger)).toBe(true);
|
||||
});
|
||||
|
||||
it('should pass through a false boolean', () => {
|
||||
expect(validateBoolean(false, 'n', 'k', logger)).toBe(false);
|
||||
});
|
||||
|
||||
it('should parse string "true" to boolean true', () => {
|
||||
expect(validateBoolean('true', 'n', 'k', logger)).toBe(true);
|
||||
});
|
||||
|
||||
it('should parse string "false" to boolean false', () => {
|
||||
expect(validateBoolean('false', 'n', 'k', logger)).toBe(false);
|
||||
});
|
||||
|
||||
it('should pass through non-boolean non-string values unchanged', () => {
|
||||
expect(validateBoolean(42, 'n', 'k', logger)).toBe(42);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateString ──────────────────────────────────────────────────
|
||||
describe('validateString()', () => {
|
||||
it('should accept a lowercase string', () => {
|
||||
expect(validateString('hello', {}, { default: '' }, 'n', 'k', logger)).toBe('hello');
|
||||
});
|
||||
|
||||
it('should convert uppercase to lowercase', () => {
|
||||
expect(validateString('Hello', {}, { default: '' }, 'n', 'k', logger)).toBe('hello');
|
||||
});
|
||||
|
||||
it('should convert a number to a string', () => {
|
||||
expect(validateString(42, {}, { default: '' }, 'n', 'k', logger)).toBe('42');
|
||||
});
|
||||
|
||||
it('should return null when nullable and value is null', () => {
|
||||
expect(validateString(null, { nullable: true }, { default: '' }, 'n', 'k', logger)).toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateEnum ────────────────────────────────────────────────────
|
||||
describe('validateEnum()', () => {
|
||||
const rules = { values: [{ value: 'open' }, { value: 'closed' }, { value: 'partial' }] };
|
||||
|
||||
it('should accept a valid enum value', () => {
|
||||
expect(validateEnum('open', rules, { default: 'closed' }, 'n', 'k', logger)).toBe('open');
|
||||
});
|
||||
|
||||
it('should be case-insensitive', () => {
|
||||
expect(validateEnum('OPEN', rules, { default: 'closed' }, 'n', 'k', logger)).toBe('open');
|
||||
});
|
||||
|
||||
it('should return default for an invalid value', () => {
|
||||
expect(validateEnum('invalid', rules, { default: 'closed' }, 'n', 'k', logger)).toBe('closed');
|
||||
});
|
||||
|
||||
it('should return default when value is null', () => {
|
||||
expect(validateEnum(null, rules, { default: 'closed' }, 'n', 'k', logger)).toBe('closed');
|
||||
});
|
||||
|
||||
it('should return default when rules.values is not an array', () => {
|
||||
expect(validateEnum('open', {}, { default: 'closed' }, 'n', 'k', logger)).toBe('closed');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// Collection validators
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
describe('collectionValidators', () => {
|
||||
let logger;
|
||||
beforeEach(() => { logger = mockLogger(); });
|
||||
|
||||
// ── validateArray ───────────────────────────────────────────────────
|
||||
describe('validateArray()', () => {
|
||||
it('should return default when value is not an array', () => {
|
||||
expect(validateArray('not-array', { itemType: 'number' }, { default: [1] }, 'n', 'k', logger))
|
||||
.toEqual([1]);
|
||||
});
|
||||
|
||||
it('should filter items by itemType', () => {
|
||||
const result = validateArray([1, 'a', 2], { itemType: 'number', minLength: 1 }, { default: [] }, 'n', 'k', logger);
|
||||
expect(result).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('should respect maxLength', () => {
|
||||
const result = validateArray([1, 2, 3, 4, 5], { itemType: 'number', maxLength: 3, minLength: 1 }, { default: [] }, 'n', 'k', logger);
|
||||
expect(result).toEqual([1, 2, 3]);
|
||||
});
|
||||
|
||||
it('should return default when fewer items than minLength after filtering', () => {
|
||||
const result = validateArray(['a'], { itemType: 'number', minLength: 1 }, { default: [0] }, 'n', 'k', logger);
|
||||
expect(result).toEqual([0]);
|
||||
});
|
||||
|
||||
it('should pass all items through when itemType is null', () => {
|
||||
const result = validateArray([1, 'a', true], { itemType: 'null', minLength: 1 }, { default: [] }, 'n', 'k', logger);
|
||||
expect(result).toEqual([1, 'a', true]);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateSet ─────────────────────────────────────────────────────
|
||||
describe('validateSet()', () => {
|
||||
it('should convert default to Set when value is not a Set', () => {
|
||||
const result = validateSet('not-a-set', { itemType: 'number' }, { default: [1, 2] }, 'n', 'k', logger);
|
||||
expect(result).toBeInstanceOf(Set);
|
||||
expect([...result]).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('should filter Set items by type', () => {
|
||||
const input = new Set([1, 'a', 2]);
|
||||
const result = validateSet(input, { itemType: 'number', minLength: 1 }, { default: [] }, 'n', 'k', logger);
|
||||
expect([...result]).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('should return default Set when too few items remain', () => {
|
||||
const input = new Set(['a']);
|
||||
const result = validateSet(input, { itemType: 'number', minLength: 1 }, { default: [0] }, 'n', 'k', logger);
|
||||
expect([...result]).toEqual([0]);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateObject ──────────────────────────────────────────────────
|
||||
describe('validateObject()', () => {
|
||||
it('should return default when value is not an object', () => {
|
||||
expect(validateObject('str', {}, { default: { a: 1 } }, 'n', 'k', jest.fn(), logger))
|
||||
.toEqual({ a: 1 });
|
||||
});
|
||||
|
||||
it('should return default when value is an array', () => {
|
||||
expect(validateObject([1, 2], {}, { default: {} }, 'n', 'k', jest.fn(), logger))
|
||||
.toEqual({});
|
||||
});
|
||||
|
||||
it('should return default when no schema is provided', () => {
|
||||
expect(validateObject({ a: 1 }, {}, { default: { b: 2 } }, 'n', 'k', jest.fn(), logger))
|
||||
.toEqual({ b: 2 });
|
||||
});
|
||||
|
||||
it('should call validateSchemaFn when schema is provided', () => {
|
||||
const mockFn = jest.fn().mockReturnValue({ validated: true });
|
||||
const rules = { schema: { x: { default: 1 } } };
|
||||
const result = validateObject({ x: 2 }, rules, {}, 'n', 'k', mockFn, logger);
|
||||
expect(mockFn).toHaveBeenCalledWith({ x: 2 }, rules.schema, 'n.k');
|
||||
expect(result).toEqual({ validated: true });
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// Curve validators
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
describe('curveValidator', () => {
|
||||
let logger;
|
||||
beforeEach(() => { logger = mockLogger(); });
|
||||
|
||||
// ── Helper utilities ────────────────────────────────────────────────
|
||||
describe('isSorted()', () => {
|
||||
it('should return true for a sorted array', () => {
|
||||
expect(isSorted([1, 2, 3, 4])).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for an unsorted array', () => {
|
||||
expect(isSorted([3, 1, 2])).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for an empty array', () => {
|
||||
expect(isSorted([])).toBe(true);
|
||||
});
|
||||
|
||||
it('should return true for equal adjacent values', () => {
|
||||
expect(isSorted([1, 1, 2])).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('isUnique()', () => {
|
||||
it('should return true when all values are unique', () => {
|
||||
expect(isUnique([1, 2, 3])).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when duplicates exist', () => {
|
||||
expect(isUnique([1, 2, 2])).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('areNumbers()', () => {
|
||||
it('should return true for all numbers', () => {
|
||||
expect(areNumbers([1, 2.5, -3])).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false when a non-number is present', () => {
|
||||
expect(areNumbers([1, 'a', 3])).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateCurve ───────────────────────────────────────────────────
|
||||
describe('validateCurve()', () => {
|
||||
const defaultCurve = { line1: { x: [0, 1], y: [0, 1] } };
|
||||
|
||||
it('should return default when input is null', () => {
|
||||
expect(validateCurve(null, defaultCurve, logger)).toEqual(defaultCurve);
|
||||
});
|
||||
|
||||
it('should return default for an empty object', () => {
|
||||
expect(validateCurve({}, defaultCurve, logger)).toEqual(defaultCurve);
|
||||
});
|
||||
|
||||
it('should validate a correct curve', () => {
|
||||
const curve = { line1: { x: [1, 2, 3], y: [10, 20, 30] } };
|
||||
const result = validateCurve(curve, defaultCurve, logger);
|
||||
expect(result.line1.x).toEqual([1, 2, 3]);
|
||||
expect(result.line1.y).toEqual([10, 20, 30]);
|
||||
});
|
||||
|
||||
it('should sort unsorted x values and reorder y accordingly', () => {
|
||||
const curve = { line1: { x: [3, 1, 2], y: [30, 10, 20] } };
|
||||
const result = validateCurve(curve, defaultCurve, logger);
|
||||
expect(result.line1.x).toEqual([1, 2, 3]);
|
||||
expect(result.line1.y).toEqual([10, 20, 30]);
|
||||
});
|
||||
|
||||
it('should remove duplicate x values', () => {
|
||||
const curve = { line1: { x: [1, 1, 2], y: [10, 11, 20] } };
|
||||
const result = validateCurve(curve, defaultCurve, logger);
|
||||
expect(result.line1.x).toEqual([1, 2]);
|
||||
expect(result.line1.y.length).toBe(2);
|
||||
});
|
||||
|
||||
it('should return default when y contains non-numbers', () => {
|
||||
const curve = { line1: { x: [1, 2], y: ['a', 'b'] } };
|
||||
expect(validateCurve(curve, defaultCurve, logger)).toEqual(defaultCurve);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateMachineCurve ────────────────────────────────────────────
|
||||
describe('validateMachineCurve()', () => {
|
||||
const defaultMC = {
|
||||
nq: { line1: { x: [0, 1], y: [0, 1] } },
|
||||
np: { line1: { x: [0, 1], y: [0, 1] } },
|
||||
};
|
||||
|
||||
it('should return default when input is null', () => {
|
||||
expect(validateMachineCurve(null, defaultMC, logger)).toEqual(defaultMC);
|
||||
});
|
||||
|
||||
it('should return default when nq or np is missing', () => {
|
||||
expect(validateMachineCurve({ nq: {} }, defaultMC, logger)).toEqual(defaultMC);
|
||||
});
|
||||
|
||||
it('should validate a correct machine curve', () => {
|
||||
const input = {
|
||||
nq: { line1: { x: [1, 2], y: [10, 20] } },
|
||||
np: { line1: { x: [1, 2], y: [5, 10] } },
|
||||
};
|
||||
const result = validateMachineCurve(input, defaultMC, logger);
|
||||
expect(result.nq.line1.x).toEqual([1, 2]);
|
||||
expect(result.np.line1.y).toEqual([5, 10]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
// ValidationUtils class
|
||||
// ═══════════════════════════════════════════════════════════════════════
|
||||
describe('ValidationUtils', () => {
|
||||
let vu;
|
||||
|
||||
beforeEach(() => {
|
||||
vu = new ValidationUtils(true, 'error'); // suppress most logging noise
|
||||
});
|
||||
|
||||
// ── constrain() ─────────────────────────────────────────────────────
|
||||
describe('constrain()', () => {
|
||||
it('should return value when within range', () => {
|
||||
expect(vu.constrain(5, 0, 10)).toBe(5);
|
||||
});
|
||||
|
||||
it('should clamp to min when value is below range', () => {
|
||||
expect(vu.constrain(-5, 0, 10)).toBe(0);
|
||||
});
|
||||
|
||||
it('should clamp to max when value is above range', () => {
|
||||
expect(vu.constrain(15, 0, 10)).toBe(10);
|
||||
});
|
||||
|
||||
it('should return min for boundary value equal to min', () => {
|
||||
expect(vu.constrain(0, 0, 10)).toBe(0);
|
||||
});
|
||||
|
||||
it('should return max for boundary value equal to max', () => {
|
||||
expect(vu.constrain(10, 0, 10)).toBe(10);
|
||||
});
|
||||
|
||||
it('should return min when value is not a number', () => {
|
||||
expect(vu.constrain('abc', 0, 10)).toBe(0);
|
||||
});
|
||||
|
||||
it('should return min when value is null', () => {
|
||||
expect(vu.constrain(null, 0, 10)).toBe(0);
|
||||
});
|
||||
|
||||
it('should return min when value is undefined', () => {
|
||||
expect(vu.constrain(undefined, 0, 10)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
// ── validateSchema() ────────────────────────────────────────────────
|
||||
describe('validateSchema()', () => {
|
||||
it('should use default value when config key is missing', () => {
|
||||
const schema = {
|
||||
speed: { default: 100, rules: { type: 'number' } },
|
||||
};
|
||||
const result = vu.validateSchema({}, schema, 'test');
|
||||
expect(result.speed).toBe(100);
|
||||
});
|
||||
|
||||
it('should use provided value over default', () => {
|
||||
const schema = {
|
||||
speed: { default: 100, rules: { type: 'number' } },
|
||||
};
|
||||
const result = vu.validateSchema({ speed: 200 }, schema, 'test');
|
||||
expect(result.speed).toBe(200);
|
||||
});
|
||||
|
||||
it('should strip unknown keys from config', () => {
|
||||
const schema = {
|
||||
speed: { default: 100, rules: { type: 'number' } },
|
||||
};
|
||||
const config = { speed: 50, unknownKey: 'bad' };
|
||||
const result = vu.validateSchema(config, schema, 'test');
|
||||
expect(result.unknownKey).toBeUndefined();
|
||||
expect(result.speed).toBe(50);
|
||||
});
|
||||
|
||||
it('should validate number type with min/max', () => {
|
||||
const schema = {
|
||||
speed: { default: 10, rules: { type: 'number', min: 0, max: 100 } },
|
||||
};
|
||||
// within range
|
||||
expect(vu.validateSchema({ speed: 50 }, schema, 'test').speed).toBe(50);
|
||||
// below min -> default
|
||||
expect(vu.validateSchema({ speed: -1 }, schema, 'test').speed).toBe(10);
|
||||
// above max -> default
|
||||
expect(vu.validateSchema({ speed: 101 }, schema, 'test').speed).toBe(10);
|
||||
});
|
||||
|
||||
it('should validate boolean type', () => {
|
||||
const schema = {
|
||||
enabled: { default: true, rules: { type: 'boolean' } },
|
||||
};
|
||||
expect(vu.validateSchema({ enabled: false }, schema, 'test').enabled).toBe(false);
|
||||
expect(vu.validateSchema({ enabled: 'true' }, schema, 'test').enabled).toBe(true);
|
||||
});
|
||||
|
||||
it('should validate string type (lowercased)', () => {
|
||||
const schema = {
|
||||
mode: { default: 'auto', rules: { type: 'string' } },
|
||||
};
|
||||
expect(vu.validateSchema({ mode: 'Manual' }, schema, 'test').mode).toBe('manual');
|
||||
});
|
||||
|
||||
it('should validate enum type', () => {
|
||||
const schema = {
|
||||
state: {
|
||||
default: 'open',
|
||||
rules: { type: 'enum', values: [{ value: 'open' }, { value: 'closed' }] },
|
||||
},
|
||||
};
|
||||
expect(vu.validateSchema({ state: 'closed' }, schema, 'test').state).toBe('closed');
|
||||
expect(vu.validateSchema({ state: 'invalid' }, schema, 'test').state).toBe('open');
|
||||
});
|
||||
|
||||
it('should validate integer type', () => {
|
||||
const schema = {
|
||||
count: { default: 5, rules: { type: 'integer', min: 1, max: 100 } },
|
||||
};
|
||||
expect(vu.validateSchema({ count: 10 }, schema, 'test').count).toBe(10);
|
||||
expect(vu.validateSchema({ count: '42' }, schema, 'test').count).toBe(42);
|
||||
});
|
||||
|
||||
it('should validate array type', () => {
|
||||
const schema = {
|
||||
items: { default: [1, 2], rules: { type: 'array', itemType: 'number', minLength: 1 } },
|
||||
};
|
||||
expect(vu.validateSchema({ items: [3, 4, 5] }, schema, 'test').items).toEqual([3, 4, 5]);
|
||||
expect(vu.validateSchema({ items: 'not-array' }, schema, 'test').items).toEqual([1, 2]);
|
||||
});
|
||||
|
||||
it('should handle nested object with schema recursively', () => {
|
||||
const schema = {
|
||||
logging: {
|
||||
rules: { type: 'object', schema: {
|
||||
enabled: { default: true, rules: { type: 'boolean' } },
|
||||
level: { default: 'info', rules: { type: 'string' } },
|
||||
}},
|
||||
},
|
||||
};
|
||||
const result = vu.validateSchema(
|
||||
{ logging: { enabled: false, level: 'Debug' } },
|
||||
schema,
|
||||
'test'
|
||||
);
|
||||
expect(result.logging.enabled).toBe(false);
|
||||
expect(result.logging.level).toBe('debug');
|
||||
});
|
||||
|
||||
it('should skip reserved keys (rules, description, schema)', () => {
|
||||
const schema = {
|
||||
rules: 'should be skipped',
|
||||
description: 'should be skipped',
|
||||
schema: 'should be skipped',
|
||||
speed: { default: 10, rules: { type: 'number' } },
|
||||
};
|
||||
const result = vu.validateSchema({}, schema, 'test');
|
||||
expect(result).not.toHaveProperty('rules');
|
||||
expect(result).not.toHaveProperty('description');
|
||||
expect(result).not.toHaveProperty('schema');
|
||||
expect(result.speed).toBe(10);
|
||||
});
|
||||
|
||||
it('should use default for unknown validation type', () => {
|
||||
const schema = {
|
||||
weird: { default: 'fallback', rules: { type: 'unknownType' } },
|
||||
};
|
||||
const result = vu.validateSchema({ weird: 'value' }, schema, 'test');
|
||||
expect(result.weird).toBe('fallback');
|
||||
});
|
||||
|
||||
it('should handle curve type', () => {
|
||||
const schema = {
|
||||
curve: {
|
||||
default: { line1: { x: [0, 1], y: [0, 1] } },
|
||||
rules: { type: 'curve' },
|
||||
},
|
||||
};
|
||||
const validCurve = { line1: { x: [1, 2], y: [10, 20] } };
|
||||
const result = vu.validateSchema({ curve: validCurve }, schema, 'test');
|
||||
expect(result.curve.line1.x).toEqual([1, 2]);
|
||||
});
|
||||
});
|
||||
|
||||
// ── removeUnwantedKeys() ────────────────────────────────────────────
|
||||
describe('removeUnwantedKeys()', () => {
|
||||
it('should remove rules and description keys', () => {
|
||||
const input = {
|
||||
speed: { default: 10, rules: { type: 'number' }, description: 'Speed setting' },
|
||||
};
|
||||
const result = vu.removeUnwantedKeys(input);
|
||||
expect(result.speed).toBe(10);
|
||||
});
|
||||
|
||||
it('should recurse into nested objects', () => {
|
||||
const input = {
|
||||
logging: {
|
||||
enabled: { default: true, rules: {} },
|
||||
level: { default: 'info', description: 'Log level' },
|
||||
},
|
||||
};
|
||||
const result = vu.removeUnwantedKeys(input);
|
||||
expect(result.logging.enabled).toBe(true);
|
||||
expect(result.logging.level).toBe('info');
|
||||
});
|
||||
|
||||
it('should handle arrays', () => {
|
||||
const input = [
|
||||
{ a: { default: 1, rules: {} } },
|
||||
{ b: { default: 2, description: 'x' } },
|
||||
];
|
||||
const result = vu.removeUnwantedKeys(input);
|
||||
expect(result[0].a).toBe(1);
|
||||
expect(result[1].b).toBe(2);
|
||||
});
|
||||
|
||||
it('should return primitives as-is', () => {
|
||||
expect(vu.removeUnwantedKeys(42)).toBe(42);
|
||||
expect(vu.removeUnwantedKeys('hello')).toBe('hello');
|
||||
expect(vu.removeUnwantedKeys(null)).toBeNull();
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user