Newer
Older
const { sequentNode, linkSequentNode } = require("../../src/utils/sequentAst.js");
// linkSequentNode test
test('linkSequentNode could work correctly for node', () => {
const inputA = new sequentNode("A");
const inputB = new sequentNode("B");
const output = linkSequentNode(inputA, inputB);
const expected = new sequentNode("A", "", [inputB]);
expect(output).toEqual(expected);
});
test('linkSequentNode could work correctly for node', () => {
const inputA = new sequentNode("A");
const inputB = new sequentNode("B");
const output = linkSequentNode(inputA, inputB);
const output1 = linkSequentNode(output, inputB);
expect(output1).toEqual(new sequentNode("A", "", [inputB, inputB]));
});
test('linkSequentNode could report error when adding nodes on a full node', () => {
const inputA = new sequentNode("A");
const inputB = new sequentNode("B");
const output = linkSequentNode(inputA, inputB);
const output1 = linkSequentNode(output, inputB);
expect(() => linkSequentNode(output1, inputB)).toThrow('Addition failed, this node is already full');
});