From 1b7bae144fab5763bbe5ae4566dfe0b9ab23a7c4 Mon Sep 17 00:00:00 2001 From: Christopher Schleiden Date: Fri, 6 Jan 2023 15:38:08 -0800 Subject: [PATCH] Update tests --- actions-languageservice/src/complete.test.ts | 8 ++++---- actions-languageservice/src/hover.test.ts | 6 ++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/actions-languageservice/src/complete.test.ts b/actions-languageservice/src/complete.test.ts index b18949e..2ba5a6f 100644 --- a/actions-languageservice/src/complete.test.ts +++ b/actions-languageservice/src/complete.test.ts @@ -1,4 +1,4 @@ -import {TextEdit} from "vscode-languageserver-types"; +import {MarkupContent, TextEdit} from "vscode-languageserver-types"; import {complete} from "./complete"; import {WorkflowContext} from "./context/workflow-context"; import {registerLogger} from "./log"; @@ -311,7 +311,7 @@ jobs: ]); // Includes detail when available. Using continue-on-error as a sample here. - expect(result.map(x => x.detail)).toContain( + expect(result.map(x => (x.documentation as MarkupContent)?.value)).toContain( "Prevents a job from failing when a step fails. Set to true to allow a job to pass when this step fails." ); }); @@ -337,7 +337,7 @@ o| const result = await complete(...getPositionFromCursor(input)); const onResult = result.find(x => x.label === "on"); expect(onResult).not.toBeUndefined(); - expect(onResult?.detail).toEqual( + expect((onResult!.documentation as MarkupContent).value).toEqual( "The name of the GitHub event that triggers the workflow. You can provide a single event string, array of events, array of event types, or an event configuration map that schedules a workflow or restricts the execution of a workflow to specific files, tags, or branch changes. For a list of available events, see https://help.github.com/en/github/automating-your-workflow-with-github-actions/events-that-trigger-workflows." ); }); @@ -348,7 +348,7 @@ o| const result = await complete(...getPositionFromCursor(input)); const dispatchResult = result.find(x => x.label === "workflow_dispatch"); expect(dispatchResult).not.toBeUndefined(); - expect(dispatchResult?.detail).toEqual( + expect((dispatchResult!.documentation as MarkupContent).value).toEqual( "You can now create workflows that are manually triggered with the new workflow_dispatch event. You will then see a 'Run workflow' button on the Actions tab, enabling you to easily trigger a run." ); }); diff --git a/actions-languageservice/src/hover.test.ts b/actions-languageservice/src/hover.test.ts index 598ed0b..c47efb8 100644 --- a/actions-languageservice/src/hover.test.ts +++ b/actions-languageservice/src/hover.test.ts @@ -1,4 +1,3 @@ -import {TextDocument} from "vscode-languageserver-textdocument"; import {hover} from "./hover"; import {getPositionFromCursor} from "./test-utils/cursor-position"; @@ -25,7 +24,6 @@ jobs: expect(result?.contents).toEqual("Runs your workflow when you push a commit or tag."); }); - it("on a parameter with a description", async () => { const input = `on: push jobs: @@ -35,7 +33,7 @@ jobs: expect(result).not.toBeUndefined(); expect(result?.contents).toEqual( "Prevents a workflow run from failing when a job fails. Set to true to allow a workflow run to pass when this job fails.\n\n" + - "**Context:** github, inputs, vars, needs, strategy, matrix" + "**Context:** github, inputs, vars, needs, strategy, matrix" ); }); @@ -52,7 +50,7 @@ jobs: }); it("on a value in a sequence", async () => { - const input = `on: [pull_request, + const input = `on: [pull_request, pu|sh] jobs: build: