Files
directus/packages/shared/tests/utils/node/list-folders.test.ts
Rijk van Zanten 84e6277f87 Move external packages to separate repos (#14335)
* Move format title to dedicated repo

* Move CLI as well

* Move create-directus-extension

* Move create-directus-project

* Move extensions sdk

* Move gatsby-source-directus

* Move sdk

* Remove sdk from jest config

* Regen package-lock

* Add missing tmp types

* Fix test import names

* Missed one
2022-07-09 15:23:44 +02:00

21 lines
609 B
TypeScript

import { listFolders } from '../../../src/utils/node/list-folders';
import { dirSync, DirResult } from 'tmp';
describe('', () => {
let rootDir: DirResult;
let childDir: DirResult;
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]]);
});
});