mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-16 01:26:24 +00:00
25 lines
833 B
TypeScript
25 lines
833 B
TypeScript
import { readFileSync } from 'fs';
|
|
import { fs } from '../../../../test/util';
|
|
import { getYarnLock } from './yarn';
|
|
|
|
jest.mock('../../../util/fs');
|
|
|
|
describe('manager/npm/extract/yarn', () => {
|
|
describe('.getYarnLock()', () => {
|
|
it('returns empty if exception parsing', async () => {
|
|
fs.readLocalFile.mockResolvedValueOnce('abcd');
|
|
const res = await getYarnLock('package.json');
|
|
expect(Object.keys(res)).toHaveLength(0);
|
|
});
|
|
it('extracts', async () => {
|
|
const plocktest1Lock = readFileSync(
|
|
'lib/manager/npm/__fixtures__/plocktest1/yarn.lock',
|
|
'utf8'
|
|
);
|
|
fs.readLocalFile.mockResolvedValueOnce(plocktest1Lock);
|
|
const res = await getYarnLock('package.json');
|
|
expect(res).toMatchSnapshot();
|
|
expect(Object.keys(res)).toHaveLength(7);
|
|
});
|
|
});
|
|
});
|