From 459d3e6dd9ed768a0dcfb4a065101e913095e913 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Fri, 14 Jun 2024 19:58:17 +0200 Subject: [PATCH] Add more tests for format2 symbol provider --- .../tests/unit/symbols.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/server/packages/workflow-tests-language-service/tests/unit/symbols.test.ts b/server/packages/workflow-tests-language-service/tests/unit/symbols.test.ts index 5fcea26..d8902f0 100644 --- a/server/packages/workflow-tests-language-service/tests/unit/symbols.test.ts +++ b/server/packages/workflow-tests-language-service/tests/unit/symbols.test.ts @@ -27,4 +27,27 @@ describe("Format2 Workflow Symbols Provider", () => { expect(symbols[1].name).toBe("Test 2"); expect(symbols[2].name).toBe("Test 3"); }); + + it("should return symbols for each test", () => { + const content = ` +- doc: a test + job: + input_1: + class: File + path: a + input 2: b + 'input:3': c`; + const symbols = getSymbols(content); + expect(symbols.length).toBe(1); + const testSymbol = symbols[0]; + expect(testSymbol.name).toBe("Test 1"); + expect(testSymbol.children?.length).toBe(2); + expect(testSymbol.children?.at(0)?.name).toBe("doc"); + const jobSymbol = testSymbol.children?.at(1); + expect(jobSymbol?.name).toBe("job"); + expect(jobSymbol?.children?.length).toBe(3); + expect(jobSymbol?.children?.at(0)?.name).toBe("input_1"); + expect(jobSymbol?.children?.at(1)?.name).toBe("input 2"); + expect(jobSymbol?.children?.at(2)?.name).toBe("input:3"); + }); });