diff --git a/lib/binding_web/test/node-test.js b/lib/binding_web/test/node-test.js index 1abef756..a87658c7 100644 --- a/lib/binding_web/test/node-test.js +++ b/lib/binding_web/test/node-test.js @@ -326,10 +326,10 @@ describe("Node", () => { ); }); - describe(".parseState", () => { + describe(".parseState, .nextParseState", () => { const text = "10 / 5"; - it(`returns node parse state ids`, async () => { + it("returns node parse state ids", async () => { tree = await parser.parse(text) const quotientNode = tree.rootNode.firstChild.firstChild; const [numerator, slash, denominator] = quotientNode.children; @@ -338,11 +338,20 @@ describe("Node", () => { // parse states will change on any change to the grammar so test that it // returns something instead assert.isAbove(numerator.parseState, 0); - assert.isAbove(numerator.nextParseState, 0); assert.isAbove(slash.parseState, 0); assert.isAbove(denominator.parseState, 0); - assert.isAbove(denominator.nextParseState, 0); }) + + it("returns next parse state equal to the language", async () => { + tree = await parser.parse(text); + const quotientNode = tree.rootNode.firstChild.firstChild; + quotientNode.children.forEach(node => { + assert.equal( + node.nextParseState, + JavaScript.nextState(node.parseState, node.grammarId) + ); + }); + }); }); describe('.descendantsOfType(type, min, max)', () => {