mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-07-31 10:47:27 +07:00
Bump version to 2.12.0
Update Node.js dependencies
This commit is contained in:
@ -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`
|
||||
|
@ -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');
|
||||
|
Reference in New Issue
Block a user