Files
directus/packages/shared/tests/utils/node/list-folders.test.ts
2022-05-27 12:43:54 -04:00

21 lines
636 B
TypeScript

import { listFolders } from '../../../src/utils/node/list-folders';
import { dirSync, SynchrounousResult } from 'tmp';
describe('', () => {
let rootDir: SynchrounousResult;
let childDir: SynchrounousResult;
beforeEach(() => {
rootDir = dirSync({ unsafeCleanup: true, tmpdir: './' } as any);
childDir = dirSync({ tmpdir: rootDir.name } as any);
});
afterEach(() => {
rootDir.removeCallback();
});
it('returns all the subdirectories of the current directory', async () => {
const childPath = childDir.name.split('/');
expect(await listFolders(rootDir.name)).toStrictEqual([childPath[childPath?.length - 1]]);
});
});