2020-11-11 14:43:37 +00:00
|
|
|
import { getSplitters } from 'consul-ui/components/consul/discovery-chain/utils';
|
2020-02-12 17:47:52 +00:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
|
2022-09-15 08:43:17 +00:00
|
|
|
module('Unit | Component | consul/discovery-chain/get-splitters', function () {
|
|
|
|
test('it collects and correctly parses splitter Names', function (assert) {
|
2020-02-12 17:47:52 +00:00
|
|
|
const actual = getSplitters({
|
2021-12-09 10:47:58 +00:00
|
|
|
'splitter:splitter-name.default.default': {
|
2020-02-12 17:47:52 +00:00
|
|
|
Type: 'splitter',
|
2021-12-09 10:47:58 +00:00
|
|
|
Name: 'splitter-name.default.default',
|
2020-02-12 17:47:52 +00:00
|
|
|
Splits: [
|
|
|
|
{
|
|
|
|
Weight: 50,
|
|
|
|
NextNode: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Weight: 50,
|
|
|
|
NextNode: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2021-12-09 10:47:58 +00:00
|
|
|
'splitter:not-splitter-name.default.default': {
|
2020-02-12 17:47:52 +00:00
|
|
|
Type: 'not-splitter',
|
2021-12-09 10:47:58 +00:00
|
|
|
Name: 'splitter-name.default.default',
|
2020-02-12 17:47:52 +00:00
|
|
|
Splits: [
|
|
|
|
{
|
|
|
|
Weight: 50,
|
|
|
|
NextNode: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Weight: 50,
|
|
|
|
NextNode: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
});
|
|
|
|
const expected = {
|
|
|
|
Type: 'splitter',
|
|
|
|
Name: 'splitter-name',
|
2021-12-09 10:47:58 +00:00
|
|
|
ID: 'splitter:splitter-name.default.default',
|
2020-02-12 17:47:52 +00:00
|
|
|
Splits: [
|
|
|
|
{
|
|
|
|
Weight: 50,
|
|
|
|
NextNode: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
Weight: 50,
|
|
|
|
NextNode: '',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
assert.equal(actual.length, 1);
|
|
|
|
assert.deepEqual(actual[0], expected);
|
|
|
|
});
|
|
|
|
});
|