mirror of
https://github.com/renovatebot/renovate.git
synced 2026-11-01 02:00:10 +00:00
05e1271376
Enables the vitest/prefer-expect-resolves oxlint rule and applies its autofix across the spec suite.
44 lines
1.3 KiB
TypeScript
44 lines
1.3 KiB
TypeScript
import { platform } from '~test/util.ts';
|
|
import { ExternalHostError } from '../../../types/errors/external-host-error.ts';
|
|
import { PRESET_DEP_NOT_FOUND } from '../util.ts';
|
|
import { fetchJSONFile, getPresetFromEndpoint } from './common.ts';
|
|
|
|
describe('config/presets/local/common', () => {
|
|
describe('fetchJSONFile', () => {
|
|
it('throws for null', async () => {
|
|
platform.getRawFile.mockResolvedValueOnce(null);
|
|
|
|
await expect(fetchJSONFile('some/repo', 'default.json')).rejects.toThrow(
|
|
PRESET_DEP_NOT_FOUND,
|
|
);
|
|
});
|
|
|
|
it('throws for ExternalHostError', async () => {
|
|
platform.getRawFile.mockRejectedValueOnce(
|
|
new ExternalHostError(new Error()),
|
|
);
|
|
|
|
await expect(fetchJSONFile('some/repo', 'default.json')).rejects.toThrow(
|
|
ExternalHostError,
|
|
);
|
|
});
|
|
|
|
it('throws for Error', async () => {
|
|
platform.getRawFile.mockRejectedValueOnce(new Error());
|
|
|
|
await expect(fetchJSONFile('some/repo', 'default.json')).rejects.toThrow(
|
|
PRESET_DEP_NOT_FOUND,
|
|
);
|
|
});
|
|
});
|
|
|
|
describe('getPresetFromEndpoint', () => {
|
|
it('works', async () => {
|
|
platform.getRawFile.mockResolvedValueOnce('{}');
|
|
await expect(
|
|
getPresetFromEndpoint('some/repo', 'default.json', undefined, 'dummy'),
|
|
).resolves.toEqual({});
|
|
});
|
|
});
|
|
});
|