0
0
Fork 0
mirror of https://github.com/renovatebot/renovate.git synced 2025-01-12 22:29:06 +00:00
renovatebot_renovate/lib/modules/manager/mise/utils.spec.ts
2024-07-08 14:27:31 +00:00

41 lines
1,000 B
TypeScript

import { codeBlock } from 'common-tags';
import { parseTomlFile } from './utils';
const miseFilename = '.mise.toml';
describe('modules/manager/mise/utils', () => {
describe('parseTomlFile', () => {
it('load and parse successfully', () => {
const fileContent = codeBlock`
[tools]
erlang = '23.3'
node = '16'
`;
const actual = parseTomlFile(fileContent, miseFilename);
expect(actual).toMatchObject({
tools: {
erlang: '23.3',
node: '16',
},
});
});
it('invalid toml', () => {
const invalidToml = codeBlock`
clearly: "invalid" "toml"
`;
const actual = parseTomlFile(invalidToml, miseFilename);
expect(actual).toBeNull();
});
it('invalid schema', () => {
const content = codeBlock`
[invalid]
erlang = '23.3'
node = '16'
`;
const actual = parseTomlFile(content, miseFilename);
expect(actual).toBeNull();
});
});
});