Skip to content

Commit 470fd29

Browse files
committed
chore: renames after review
1 parent 3aa2fd9 commit 470fd29

File tree

14 files changed

+42
-46
lines changed

14 files changed

+42
-46
lines changed

packages/respect-core/src/modules/__tests__/config-parser/parse-request-body.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ vi.mock('node:fs');
1010
describe('parseRequestBody', () => {
1111
const ctx = {
1212
options: {
13-
workflowPath: 'test.yaml',
13+
filePath: 'test.yaml',
1414
requestFileLoader: {
1515
getFileBody: async (filePath: string) => {
1616
await new Promise((resolve, reject) => {

packages/respect-core/src/modules/__tests__/flow-runner/call-api-and-analyze-results.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ describe('callAPIAndAnalyzeResults', () => {
312312
},
313313
},
314314
options: {
315-
workflowPath: 'simple.yaml',
315+
filePath: 'simple.yaml',
316316
metadata: {
317317
_: [],
318318
files: ['simple.yaml'],

packages/respect-core/src/modules/__tests__/flow-runner/context/create-runtime-expression-ctx.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const testDescription = {
4444
} as unknown as TestDescription;
4545

4646
const options: AppOptions = {
47-
workflowPath: 'modules/description-parser/test.test.yaml',
47+
filePath: 'modules/description-parser/test.test.yaml',
4848
workflow: undefined,
4949
metadata: {},
5050
verbose: false,

packages/respect-core/src/modules/__tests__/flow-runner/context/create-test-context.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe('createTestContext', () => {
4848
} as unknown as TestDescription;
4949

5050
const options = {
51-
workflowPath: 'modules/description-parser/test.test.yaml',
51+
filePath: 'modules/description-parser/test.test.yaml',
5252
workflow: undefined,
5353
metadata: {},
5454
verbose: false,
@@ -517,7 +517,7 @@ describe('createTestContext', () => {
517517
env: {},
518518
},
519519
options: {
520-
workflowPath: 'modules/description-parser/test.test.yaml',
520+
filePath: 'modules/description-parser/test.test.yaml',
521521
workflow: undefined,
522522
metadata: {},
523523
verbose: false,
@@ -552,7 +552,7 @@ describe('createTestContext', () => {
552552
};
553553

554554
const options: AppOptions = {
555-
workflowPath: 'test.test.yaml',
555+
filePath: 'test.test.yaml',
556556
workflow: undefined,
557557
metadata: {},
558558
verbose: false,
@@ -603,7 +603,7 @@ describe('createTestContext', () => {
603603
};
604604

605605
const options: AppOptions = {
606-
workflowPath: 'test.test.yaml',
606+
filePath: 'test.test.yaml',
607607
input: JSON.stringify({ testInput: 'testValue' }),
608608
workflow: undefined,
609609
skip: undefined,
@@ -674,7 +674,7 @@ describe('createTestContext', () => {
674674
} as unknown as TestDescription;
675675

676676
const options = {
677-
workflowPath: 'test.test.yaml',
677+
filePath: 'test.test.yaml',
678678
input: JSON.stringify({ input1: 'value1' }),
679679
} as unknown as AppOptions;
680680

@@ -716,7 +716,7 @@ describe('createTestContext', () => {
716716
} as unknown as TestDescription;
717717

718718
const options = {
719-
workflowPath: 'test.test.yaml',
719+
filePath: 'test.test.yaml',
720720
} as unknown as AppOptions;
721721

722722
const apiClient = new ApiFetcher({});
@@ -749,7 +749,7 @@ describe('createTestContext', () => {
749749
} as unknown as TestDescription;
750750

751751
const options = {
752-
workflowPath: 'test.test.yaml',
752+
filePath: 'test.test.yaml',
753753
envVariables: {
754754
ENV_VAR: 'value',
755755
},

packages/respect-core/src/modules/__tests__/flow-runner/prepare-request.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ describe('prepareRequest', () => {
301301
},
302302
},
303303
options: {
304-
workflowPath: 'simple.yaml',
304+
filePath: 'simple.yaml',
305305
metadata: {
306306
_: [],
307307
files: ['simple.yaml'],
@@ -544,7 +544,7 @@ describe('prepareRequest', () => {
544544
},
545545
},
546546
options: {
547-
workflowPath: 'simple.yaml',
547+
filePath: 'simple.yaml',
548548
metadata: {
549549
_: [],
550550
files: ['simple.yaml'],
@@ -670,7 +670,7 @@ describe('prepareRequest', () => {
670670
},
671671
$steps: {},
672672
options: {
673-
workflowPath: 'simple.yaml',
673+
filePath: 'simple.yaml',
674674
metadata: {
675675
_: [],
676676
files: ['simple.yaml'],
@@ -871,7 +871,7 @@ describe('prepareRequest', () => {
871871
},
872872
$steps: {},
873873
options: {
874-
workflowPath: 'simple.yaml',
874+
filePath: 'simple.yaml',
875875
metadata: {
876876
_: [],
877877
files: ['simple.yaml'],
@@ -1074,7 +1074,7 @@ describe('prepareRequest', () => {
10741074
},
10751075
$steps: {},
10761076
options: {
1077-
workflowPath: 'simple.yaml',
1077+
filePath: 'simple.yaml',
10781078
metadata: {
10791079
_: [],
10801080
files: ['simple.yaml'],

packages/respect-core/src/modules/__tests__/flow-runner/run-step.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ const basicCTX = {
604604
},
605605
$steps: {},
606606
options: {
607-
workflowPath: 'runStepTest.yml',
607+
filePath: 'runStepTest.yml',
608608
workflow: undefined,
609609
skip: undefined,
610610
verbose: true,
@@ -2468,7 +2468,7 @@ describe('runStep', () => {
24682468
},
24692469
$steps: {},
24702470
options: {
2471-
workflowPath: 'runStepTest.yml',
2471+
filePath: 'runStepTest.yml',
24722472
workflow: undefined,
24732473
skip: undefined,
24742474
verbose: undefined,
@@ -2879,7 +2879,7 @@ describe('runStep', () => {
28792879
},
28802880
$steps: {},
28812881
options: {
2882-
workflowPath: 'runStepTest.yml',
2882+
filePath: 'runStepTest.yml',
28832883
workflow: undefined,
28842884
skip: undefined,
28852885
verbose: undefined,
@@ -3314,7 +3314,7 @@ describe('runStep', () => {
33143314
},
33153315
$steps: {},
33163316
options: {
3317-
workflowPath: 'runStepTest.yml',
3317+
filePath: 'runStepTest.yml',
33183318
workflow: undefined,
33193319
skip: undefined,
33203320
verbose: undefined,
@@ -3780,7 +3780,7 @@ describe('runStep', () => {
37803780
},
37813781
$steps: {},
37823782
options: {
3783-
workflowPath: 'runStepTest.yml',
3783+
filePath: 'runStepTest.yml',
37843784
workflow: undefined,
37853785
skip: undefined,
37863786
verbose: undefined,

packages/respect-core/src/modules/__tests__/flow-runner/runner/create-workflow-runner.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('runWorkflow', () => {
9191
],
9292
options: {
9393
verbose: false,
94-
workflowPath: fileName,
94+
filePath: fileName,
9595
logger,
9696
},
9797
} as unknown as TestContext;
@@ -116,7 +116,7 @@ describe('runWorkflow', () => {
116116
workflows: [workflow],
117117
options: {
118118
verbose: false,
119-
workflowPath: fileName,
119+
filePath: fileName,
120120
logger,
121121
},
122122
} as unknown as TestContext;
@@ -136,7 +136,7 @@ describe('runWorkflow', () => {
136136
workflows: [],
137137
options: {
138138
verbose: false,
139-
workflowPath: fileName,
139+
filePath: fileName,
140140
logger,
141141
},
142142
} as unknown as TestContext;
@@ -220,7 +220,7 @@ describe('runWorkflow', () => {
220220
severity: DEFAULT_SEVERITY_CONFIGURATION,
221221
options: {
222222
verbose: false,
223-
workflowPath: fileName,
223+
filePath: fileName,
224224
logger,
225225
},
226226
$outputs: {},
@@ -292,7 +292,7 @@ describe('runWorkflow', () => {
292292
],
293293
options: {
294294
verbose: false,
295-
workflowPath: fileName,
295+
filePath: fileName,
296296
logger,
297297
},
298298
$outputs: {},
@@ -346,7 +346,7 @@ describe('runWorkflow', () => {
346346
],
347347
options: {
348348
verbose: false,
349-
workflowPath: fileName,
349+
filePath: fileName,
350350
logger,
351351
},
352352
$outputs: {},
@@ -446,7 +446,7 @@ describe('runWorkflow', () => {
446446
severity: DEFAULT_SEVERITY_CONFIGURATION,
447447
options: {
448448
verbose: false,
449-
workflowPath: fileName,
449+
filePath: fileName,
450450
logger,
451451
},
452452
$outputs: {},

packages/respect-core/src/modules/__tests__/flow-runner/runner/resolve-workflow-context.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ describe('resolveWorkflowContext', async () => {
317317
},
318318
},
319319
options: {
320-
workflowPath: 'examples/museum-api/museum-api-test.yaml',
320+
filePath: 'examples/museum-api/museum-api-test.yaml',
321321
workflow: undefined,
322322
skip: undefined,
323323
verbose: undefined,
@@ -362,7 +362,7 @@ describe('resolveWorkflowContext', async () => {
362362
input: undefined,
363363
skip: undefined,
364364
workflow: ['get-museum-tickets'],
365-
workflowPath: expect.stringContaining('examples/museum-api/museum-tickets.yaml'),
365+
filePath: expect.stringContaining('examples/museum-api/museum-tickets.yaml'),
366366
config,
367367
executionTimeout: 3_600_000,
368368
maxSteps: 2000,
@@ -375,7 +375,7 @@ describe('resolveWorkflowContext', async () => {
375375
);
376376
});
377377

378-
it('should call createTestContext with empty workflowPath when there are no ctx.sourceDescriptions', async () => {
378+
it('should call createTestContext with empty filePath when there are no ctx.sourceDescriptions', async () => {
379379
const ctx = {
380380
...commonCtx,
381381
...{ sourceDescriptions: [] },
@@ -389,7 +389,7 @@ describe('resolveWorkflowContext', async () => {
389389
input: undefined,
390390
skip: undefined,
391391
workflow: ['get-museum-tickets'],
392-
workflowPath: '',
392+
filePath: '',
393393
config,
394394
executionTimeout: 3_600_000,
395395
maxSteps: 2000,
@@ -412,7 +412,7 @@ describe('resolveWorkflowContext', async () => {
412412
input: undefined,
413413
skip: undefined,
414414
workflow: ['get-museum-tickets'],
415-
workflowPath: 'museum-api.yaml',
415+
filePath: 'museum-api.yaml',
416416
config,
417417
executionTimeout: 3_600_000,
418418
maxSteps: 2000,

packages/respect-core/src/modules/__tests__/flow-runner/runner/run-test-file.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ describe('runTestFile', () => {
579579
} as any);
580580
vi.mocked(bundle).mockResolvedValueOnce(undefined as any);
581581
await expect(
582-
runTestFile({ file: 'test.yaml', ...{ ...defaultRespectOptions, workflowPath: 'test.yaml' } })
582+
runTestFile({ file: 'test.yaml', ...{ ...defaultRespectOptions, filePath: 'test.yaml' } })
583583
).rejects.toThrowError(
584584
`Could not find source description file 'api-samples/not-existing.yaml'.`
585585
);

packages/respect-core/src/modules/context-parser/parse-request-body.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,7 @@ const getRequestBodyMultipartFormData = async (
6767

6868
const getRequestBodyOctetStream = async (payload: RequestBody['payload'], ctx: TestContext) => {
6969
if (typeof payload === 'string' && payload.startsWith('$file(') && payload.endsWith(')')) {
70-
const filePath = path.resolve(
71-
path.dirname(ctx.options.workflowPath),
72-
stripFileDecorator(payload)
73-
);
70+
const filePath = path.resolve(path.dirname(ctx.options.filePath), stripFileDecorator(payload));
7471

7572
return ctx.options.requestFileLoader.getFileBody(filePath);
7673
} else {
@@ -107,7 +104,7 @@ export async function parseRequestBody(
107104

108105
if (contentType === 'multipart/form-data') {
109106
const formData = new FormData();
110-
const workflowFilePath = path.resolve(ctx.options.workflowPath);
107+
const workflowFilePath = path.resolve(ctx.options.filePath);
111108

112109
await getRequestBodyMultipartFormData(payload, formData, workflowFilePath, ctx);
113110

0 commit comments

Comments
 (0)