Skip to content

Commit a59cb80

Browse files
fix: tests and linting
1 parent 9f93795 commit a59cb80

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

src/install/index.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,11 @@ export async function getLatestVersionTag(): Promise<string> {
4848
if (error.response) {
4949
// The request was made and the server responded with a status code
5050
// that falls out of the range of 2xx
51-
throw new Error(
52-
`[FATAL] Error while retrieving latest version tag: '${error.message}'.`,
53-
);
51+
throw new Error(`[FATAL] Error while retrieving latest version tag: '${error.message}'.`);
5452
} else if (error.request) {
55-
throw new Error(
56-
`[FATAL] Error while retrieving latest version tag: '${error.message}'.`,
57-
);
53+
throw new Error(`[FATAL] Error while retrieving latest version tag: '${error.message}'.`);
5854
} else {
59-
throw new Error(
60-
`[FATAL] Error while retrieving latest version tag: '${error.message}'.`,
61-
);
55+
throw new Error(`[FATAL] Error while retrieving latest version tag: '${error.message}'.`);
6256
}
6357
});
6458
}

test/install/index.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function prepareMocks(architecture: string, platform: any, version = '0.2.328',
2525
if (axiosFail) {
2626
axiosMock.mockRejectedValue({ message: 'Just Testing', config: 'Test config' });
2727
} else {
28-
axiosMock.mockResolvedValue({ data: { tag_name: version } });
28+
axiosMock.mockResolvedValue({ request: { path: `/Azure/bicep/releases/tag/v${version}` } });
2929
}
3030
}
3131

@@ -77,9 +77,7 @@ describe('getLatestVersionTag returns a valid tag', () => {
7777
try {
7878
await getLatestVersionTag();
7979
} catch (err) {
80-
expect(err).toEqual(
81-
new Error(`[FATAL] Error while retrieving latest version tag: 'Just Testing'.\nConfig: 'Test config'`),
82-
);
80+
expect(err).toEqual(new Error(`[FATAL] Error while retrieving latest version tag: 'Just Testing'.`));
8381
}
8482
});
8583
});

0 commit comments

Comments
 (0)