chore: fixing broken tests

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-02-17 15:24:35 +01:00
parent 504e03b537
commit f65b60d101
4 changed files with 12 additions and 9 deletions
@@ -62,7 +62,10 @@ describe('fetch:rails', () => {
help: 'me',
},
},
baseUrl: 'somebase',
templateInfo: {
baseUrl: 'somebase',
entityRef: 'template:default/myTemplate',
},
workspacePath: mockTmpDir,
logger: getVoidLogger(),
logStream: new PassThrough(),
@@ -100,7 +103,7 @@ describe('fetch:rails', () => {
expect(fetchContents).toHaveBeenCalledWith({
reader: mockReader,
integrations,
baseUrl: mockContext.baseUrl,
baseUrl: mockContext.templateInfo.baseUrl,
fetchUrl: mockContext.input.url,
outputPath: resolvePath(mockContext.workspacePath),
});
@@ -202,7 +202,7 @@ describe('fetch:template', () => {
it('uses fetchContents to retrieve the template content', () => {
expect(mockFetchContents).toHaveBeenCalledWith(
expect.objectContaining({
baseUrl: context.baseUrl,
baseUrl: context.templateInfo?.baseUrl,
fetchUrl: context.input.url,
}),
);
@@ -94,7 +94,7 @@ describe('LegacyWorkflowRunner', () => {
});
it('should pass metadata through', async () => {
const templateName = 'template name';
const entityRef = `template:default/templateName`;
const task = createMockTaskWithSpec({
apiVersion: 'backstage.io/v1beta2',
steps: [
@@ -107,13 +107,13 @@ describe('LegacyWorkflowRunner', () => {
],
output: {},
values: {},
templateInfo: { entityRef: `template:default/${templateName}` },
templateInfo: { entityRef },
});
await runner.execute(task);
expect(fakeActionHandler.mock.calls[0][0].templateInfo).toEqual({
name: templateName,
entityRef,
});
});
@@ -163,7 +163,7 @@ describe('DefaultWorkflowRunner', () => {
});
it('should pass metadata through', async () => {
const templateName = 'template name';
const entityRef = `template:default/templateName`;
const task = createMockTaskWithSpec({
apiVersion: 'scaffolder.backstage.io/v1beta3',
parameters: {},
@@ -176,13 +176,13 @@ describe('DefaultWorkflowRunner', () => {
input: { foo: 1 },
},
],
templateInfo: { entityRef: `template:default/${templateName}` },
templateInfo: { entityRef },
});
await runner.execute(task);
expect(fakeActionHandler.mock.calls[0][0].templateInfo).toEqual({
name: templateName,
entityRef,
});
});