Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
fix: tests, add marcelmindemann as CODEOWNER (#16)
Browse files Browse the repository at this point in the history
* fix: tests

* fix: paths

* add marcelmindemann as CODEOWNER
  • Loading branch information
cbrgm authored Jun 23, 2023
1 parent ca66546 commit 9f0fa37
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
# the repo. Unless a later match takes precedence,
# mentioned account names will be requested for
# review when someone opens a pull request.
* @msiuts @snowiow @guusvw @djablonski-moia @oppermax @cbrgm
* @msiuts @snowiow @guusvw @djablonski-moia @oppermax @cbrgm @marcelmindemann
16 changes: 8 additions & 8 deletions __tests__/run.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('Testing all functions in run file.', () => {
['amd64']
])('getEksctlDownloadURL() must return the URL to download %s eksctl for Linux based systems', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Linux');
const eksctlLinuxUrl = util.format('https://github.com/weaveworks/eksctl/releases/download/0.57.0/eksctl_Linux_%s.tar.gz', arch);
const eksctlLinuxUrl = util.format('https://github.com/weaveworks/eksctl/releases/download/v0.57.0/eksctl_Linux_%s.tar.gz', arch);

expect(run.getEksctlDownloadURL('0.57.0', arch)).toBe(eksctlLinuxUrl);
expect(os.type).toBeCalled();
Expand All @@ -65,7 +65,7 @@ describe('Testing all functions in run file.', () => {
['amd64']
])('getEksctlDownloadURL() must return the URL to download %s eksctl for MacOS based systems', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Darwin');
const eksctlDarwinUrl = util.format('https://github.com/weaveworks/eksctl/releases/download/0.57.0/eksctl_Darwin_%s.tar.gz', arch);
const eksctlDarwinUrl = util.format('https://github.com/weaveworks/eksctl/releases/download/v0.57.0/eksctl_Darwin_%s.tar.gz', arch);

expect(run.getEksctlDownloadURL('0.57.0', arch)).toBe(eksctlDarwinUrl);
expect(os.type).toBeCalled();
Expand All @@ -77,7 +77,7 @@ describe('Testing all functions in run file.', () => {
['amd64']
])('getEksctlDownloadURL() must return the URL to download %s eksctl for Windows based systems', (arch) => {
jest.spyOn(os, 'type').mockReturnValue('Windows_NT');
const eksctlWindowsUrl = util.format('https://github.com/weaveworks/eksctl/releases/download/0.57.0/eksctl_Windows_%s.zip', arch);
const eksctlWindowsUrl = util.format('https://github.com/weaveworks/eksctl/releases/download/v0.57.0/eksctl_Windows_%s.zip', arch);

expect(run.getEksctlDownloadURL('0.57.0', arch)).toBe(eksctlWindowsUrl);
expect(os.type).toBeCalled();
Expand All @@ -87,10 +87,10 @@ describe('Testing all functions in run file.', () => {
jest.spyOn(toolCache, 'find').mockReturnValue('');
jest.spyOn(toolCache, 'downloadTool').mockReturnValue(Promise.resolve('eksctlDownloadPath'));
jest.spyOn(toolCache, 'extractTar').mockReturnValue(Promise.resolve('eksctlExtractedFolder'));

jest.spyOn(toolCache, 'cacheDir').mockReturnValue(Promise.resolve('pathToCachedTool'));
jest.spyOn(os, 'type').mockReturnValue('Linux');
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {});
jest.spyOn(fs, 'chmodSync').mockImplementation(() => { });

expect(await run.downloadEksctl('0.57.0')).toBe(path.join('pathToCachedTool', 'eksctl'));
expect(toolCache.find).toBeCalledWith('eksctl', '0.57.0');
Expand All @@ -104,10 +104,10 @@ describe('Testing all functions in run file.', () => {
jest.spyOn(toolCache, 'find').mockReturnValue('');
jest.spyOn(toolCache, 'downloadTool').mockReturnValue(Promise.resolve('eksctlDownloadPath'));
jest.spyOn(toolCache, 'extractZip').mockReturnValue(Promise.resolve('eksctlExtractedFolder'));

jest.spyOn(toolCache, 'cacheDir').mockReturnValue(Promise.resolve('pathToCachedTool'));
jest.spyOn(os, 'type').mockReturnValue('Windows_NT');
jest.spyOn(fs, 'chmodSync').mockImplementation(() => {});
jest.spyOn(fs, 'chmodSync').mockImplementation(() => { });

expect(await run.downloadEksctl('0.57.0')).toBe(path.join('pathToCachedTool', 'eksctl.exe'));
expect(toolCache.find).toBeCalledWith('eksctl', '0.57.0');
Expand Down Expand Up @@ -136,4 +136,4 @@ describe('Testing all functions in run file.', () => {
expect(toolCache.downloadTool).toBeCalled();
expect(fs.readFileSync).toBeCalledWith('pathToTool', 'utf8');
});
})
})

0 comments on commit 9f0fa37

Please sign in to comment.