Skip to content

Commit

Permalink
Bump version to 2.12.0
Browse files Browse the repository at this point in the history
Update Node.js dependencies
  • Loading branch information
shivammathur committed Jul 14, 2021
1 parent 6a9b001 commit a3727c2
Show file tree
Hide file tree
Showing 5 changed files with 1,867 additions and 1,662 deletions.
24 changes: 12 additions & 12 deletions __tests__/tools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ function getData(data: IData): Record<string, string> {

jest
.spyOn(utils, 'fetch')
.mockImplementation(async (url: string, token?: string): Promise<
Record<string, string>
> => {
if (!token || token === 'valid_token') {
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
} else if (token === 'beta_token') {
return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
} else if (token === 'no_data') {
return {data: '[]'};
} else {
return {error: 'Invalid token'};
.mockImplementation(
async (url: string, token?: string): Promise<Record<string, string>> => {
if (!token || token === 'valid_token') {
return {data: `[{"ref": "refs/tags/1.2.3", "url": "${url}"}]`};
} else if (token === 'beta_token') {
return {data: `[{"ref": "refs/tags/1.2.3-beta1", "url": "${url}"}]`};
} else if (token === 'no_data') {
return {data: '[]'};
} else {
return {error: 'Invalid token'};
}
}
});
);

describe('Tools tests', () => {
it.each`
Expand Down
20 changes: 11 additions & 9 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,17 @@ describe('Utils tests', () => {
});

it('checking parseVersion', async () => {
jest.spyOn(utils, 'fetch').mockImplementation(async (url, token?): Promise<
Record<string, string>
> => {
if (!token || token === 'valid_token') {
return {data: `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`};
} else {
return {error: 'Invalid token'};
}
});
jest
.spyOn(utils, 'fetch')
.mockImplementation(
async (url, token?): Promise<Record<string, string>> => {
if (!token || token === 'valid_token') {
return {data: `{ "latest": "8.0", "5.x": "5.6", "url": "${url}" }`};
} else {
return {error: 'Invalid token'};
}
}
);
expect(await utils.parseVersion('latest')).toBe('8.0');
expect(await utils.parseVersion('7')).toBe('7.0');
expect(await utils.parseVersion('7.4')).toBe('7.4');
Expand Down

0 comments on commit a3727c2

Please sign in to comment.