Skip to content

Commit

Permalink
define step
Browse files Browse the repository at this point in the history
  • Loading branch information
war-in committed May 20, 2024
1 parent 2681751 commit 9f96e0c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions workflow_tests/utils/preGenerateTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import {exit} from 'process';
import yaml from 'yaml';
import type {YamlMockJob, YamlWorkflow} from './JobMocker';

type Step = {name: string; with?: string; envs?: string[]; inputs?: string[]};

const workflowsDirectory = path.resolve(__dirname, '..', '..', '.github', 'workflows');
const workflowTestsDirectory = path.resolve(__dirname, '..');
const workflowTestMocksDirectory = path.join(workflowTestsDirectory, 'mocks');
Expand Down Expand Up @@ -199,7 +201,7 @@ const parseWorkflowFile = (workflow: YamlWorkflow) => {
workflowJobs[jobId] = {
steps: [],
};
job.steps.forEach((step) => {
job.steps.forEach((step: Step) => {
const workflowStep = {
name: step.name,
inputs: Object.keys(step.with ?? {}),
Expand Down Expand Up @@ -243,7 +245,7 @@ const getAssertionsFileContent = (jobs: Record<string, YamlMockJob>): string =>

Object.entries(jobs).forEach(([jobId, job]) => {
let stepAssertionsContent = '';
job.steps.forEach((step) => {
job.steps.forEach((step: Step) => {
stepAssertionsContent += stepAssertionTemplate(step.name, jobId.toUpperCase(), step.name, step.inputs, step.envs);
});
const jobAssertionName = `assert${jobId.charAt(0).toUpperCase() + jobId.slice(1)}JobExecuted`;
Expand Down

0 comments on commit 9f96e0c

Please sign in to comment.