From 20e99a225cc2e3a0737e59d0e37be4e4e90cffd7 Mon Sep 17 00:00:00 2001 From: Josh Gross Date: Wed, 23 Nov 2022 15:23:17 -0500 Subject: [PATCH] Add more mapping key test cases --- .../src/utils/find-token.test.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/actions-languageservice/src/utils/find-token.test.ts b/actions-languageservice/src/utils/find-token.test.ts index 37cd3da..45fdae3 100644 --- a/actions-languageservice/src/utils/find-token.test.ts +++ b/actions-languageservice/src/utils/find-token.test.ts @@ -197,6 +197,32 @@ jobs: }); }); + it("pos after mapping key", () => { + expect( + testFindToken(`on: push +jobs: + build: + continue-on-error:| foo`) + ).toEqual({ + parent: ["job-factory", TokenType.Mapping], + key: null, + token: null + }); + }); + + it("pos at end of completed mapping key", () => { + expect( + testFindToken(`on: push +jobs: + build: + continue-on-error|: foo`) + ).toEqual({ + parent: ["job-factory", TokenType.Mapping], + key: null, + token: [null, TokenType.String, "continue-on-error"] + }); + }); + it("pos in mapping key without comment", () => { expect( testFindToken(`on: push