Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(preset): add tests for biomeVersions #28965

Merged
merged 2 commits into from
May 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions lib/config/presets/internal/regex-managers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,46 @@ import { extractPackageFile } from '../../../modules/manager/custom/regex';
import { presets } from './regex-managers';

describe('config/presets/internal/regex-managers', () => {
describe('Update `$schema` version in biome.json', () => {
const customManager = presets['biomeVersions'].customManagers?.[0];

it(`find dependencies in file`, async () => {
const fileContent = codeBlock`
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
}
`;

const res = await extractPackageFile(
fileContent,
'biome.json',
customManager!,
);

expect(res?.deps).toMatchObject([
{
currentValue: '1.7.3',
datasource: 'npm',
depName: '@biomejs/biome',
replaceString: '"https://biomejs.dev/schemas/1.7.3/schema.json"',
},
]);
});

describe('matches regexes patterns', () => {
it.each`
path | expected
${'biome.json'} | ${true}
${'biome.jsonc'} | ${true}
${'foo/biome.json'} | ${true}
${'foo/biome.jsonc'} | ${true}
${'biome.yml'} | ${false}
`('$path', ({ path, expected }) => {
expect(regexMatches(path, customManager!.fileMatch)).toBe(expected);
});
});
});

describe('Update `_VERSION` variables in Bitbucket Pipelines', () => {
const customManager =
presets['bitbucketPipelinesVersions'].customManagers?.[0];
Expand Down