Bump version to 2.12.0

Update Node.js dependencies
This commit is contained in:
Shivam Mathur
2021-07-14 14:38:18 +05:30
parent 6a9b0017a4
commit a3727c20a4
5 changed files with 1855 additions and 1650 deletions

View File

@ -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`

View File

@ -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');