Files
languageservices/actions-languageservice/src/hover.reusable-workflow.test.ts
T

62 lines
1.7 KiB
TypeScript
Raw Normal View History

import {hover} from "./hover";
import {testHoverConfig} from "./hover.test";
2023-02-15 14:50:26 -08:00
import {getPositionFromCursor} from "./test-utils/cursor-position";
describe("hover on reusable workflows", () => {
2023-02-15 14:50:26 -08:00
it("hover on job input with description", async () => {
const input = `
on: push
jobs:
build:
uses: ./reusable-workflow-with-inputs.yaml
with:
us|ername:
`;
2023-02-17 13:04:33 -08:00
const result = await hover(...getPositionFromCursor(input), testHoverConfig("username", "scalar-needs-context"));
2023-02-15 14:50:26 -08:00
expect(result).not.toBeUndefined();
expect(result?.contents).toEqual(
2023-02-17 13:04:33 -08:00
"A username passed from the caller workflow\n\n**Context:** github, inputs, vars, needs, strategy, matrix"
2023-02-15 14:50:26 -08:00
);
});
it("hover on job input without description", async () => {
const input = `
on: push
jobs:
build:
uses: ./reusable-workflow-with-inputs-no-description.yaml
with:
us|ername:
`;
const result = await hover(...getPositionFromCursor(input));
expect(result).not.toBeUndefined();
expect(result?.contents).toEqual("**Context:** github, inputs, vars, needs, strategy, matrix");
});
2023-02-21 14:50:28 -08:00
it("hover on job output with description", async () => {
const input = `
on: push
jobs:
build:
uses: ./reusable-workflow-with-outputs.yaml
echo_outputs:
runs-on: ubuntu-latest
needs: build
steps:
- run: echo \${{ needs.build.outputs.bu|ild_id }}
`;
const result = await hover(
...getPositionFromCursor(input),
testHoverConfig("", "string-steps-context")
);
expect(result).not.toBeUndefined();
expect(result?.contents).toEqual(
"The resulting build ID\n\n**Context:** github, inputs, vars, needs, strategy, matrix, secrets, steps, job, runner, env, hashFiles(1,255)"
);
});
2023-02-15 14:50:26 -08:00
});