@featurevisor/core
Version:
Core package of Featurevisor for Node.js usage
42 lines • 1.49 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const matrix_1 = require("./matrix");
describe("core :: tester :: matrix", function () {
test("should empty array when no keys are available", function () {
const matrix = {};
const combinations = (0, matrix_1.getMatrixCombinations)(matrix);
expect(combinations).toEqual([]);
});
test("should get combinations from matrix with two keys", function () {
const matrix = {
a: [1, 2],
b: ["x", "y"],
};
const combinations = (0, matrix_1.getMatrixCombinations)(matrix);
expect(combinations).toEqual([
{ a: 1, b: "x" },
{ a: 1, b: "y" },
{ a: 2, b: "x" },
{ a: 2, b: "y" },
]);
});
test("should get combinations from matrix with three keys", function () {
const matrix = {
a: [1, 2],
b: ["x", "y"],
c: [true, false],
};
const combinations = (0, matrix_1.getMatrixCombinations)(matrix);
expect(combinations).toEqual([
{ a: 1, b: "x", c: true },
{ a: 1, b: "x", c: false },
{ a: 1, b: "y", c: true },
{ a: 1, b: "y", c: false },
{ a: 2, b: "x", c: true },
{ a: 2, b: "x", c: false },
{ a: 2, b: "y", c: true },
{ a: 2, b: "y", c: false },
]);
});
});
//# sourceMappingURL=matrix.spec.js.map