@hashgraph/solo
Version:
An opinionated CLI tool to deploy and manage private Hedera Networks.
34 lines • 1.79 kB
JavaScript
// SPDX-License-Identifier: Apache-2.0
import { expect } from 'chai';
import { Comparators } from '../../../../src/business/utils/comparators.js';
import { SimpleConfigSourceFixture } from '../../fixtures/simple-config-source.fixture.js';
describe('Comparators', () => {
describe('number comparator', () => {
it('should return -1 when the first number is less than the second', () => {
expect(Comparators.number(1, 2)).to.equal(-1);
});
it('should return 1 when the first number is greater than the second', () => {
expect(Comparators.number(3, 2)).to.equal(1);
});
it('should return 0 when the numbers are equal', () => {
expect(Comparators.number(2, 2)).to.equal(0);
});
});
describe('configSource comparator', () => {
let configSource1, configSource2;
before(() => {
configSource1 = new SimpleConfigSourceFixture('simpleConfigSource1', 1, 'simpleConfigSource1', undefined, new Map());
configSource2 = new SimpleConfigSourceFixture('simpleConfigSource2', 2, 'simpleConfigSource2', undefined, new Map());
});
it('should return -1 when the first configSource ordinal is less than the second', () => {
expect(Comparators.configSource(configSource1, configSource2)).to.equal(-1);
});
it('should return 1 when the first configSource ordinal is greater than the second', () => {
expect(Comparators.configSource(configSource2, configSource1)).to.equal(1);
});
it('should return 0 when the configSource ordinals are equal', () => {
expect(Comparators.configSource(configSource1, configSource1)).to.equal(0);
});
});
});
//# sourceMappingURL=comparators.test.js.map