1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00
joplin/packages/tools/checkLibPaths.test.ts

37 lines
924 B
TypeScript

import { findInvalidImportPaths } from './checkLibPaths';
describe('checkLibPaths', function() {
test('should detect invalid lib paths', async () => {
const testCases: [number, string][] = [
[1, `
import time from '../lib/time';
`],
[2, `
import time from '../lib/time';
import shim from '../lib/shim';
`],
[1, `
import time from '../lib/time';
import shim from '@joplin/lib/shim';
`],
[1, `
import time from '@joplin/lib/time';
import shim = require('../lib/shim');
`],
[1, `
import time from '@joplin/lib/time';
import shim from '@joplin/lib/shim';
const { isInsideContainer } = require('../lib/shim');
`],
];
for (const testCase of testCases) {
const [expected, input] = testCase;
const actual = findInvalidImportPaths(__dirname, input.split('\n').map(l => l.trim()).join('\n'));
expect(actual.length).toBe(expected);
}
});
});