test(standalone): add test coverage to assure root dir for staticDir throws

This commit is contained in:
Oscar Dominguez 2021-02-26 16:55:21 +01:00
parent 2279a7933c
commit a5ebfc2bc8

View File

@ -203,4 +203,21 @@ describe('dev cli flags', () => {
);
});
});
describe('Invalid staticDir must throw: root directory /', () => {
const optionsWithInvalidStaticDir = {
...cliOptions,
staticDir: ['/'],
};
beforeEach(() => {
jest.clearAllMocks();
cache.clear();
});
it('production mode', async () => {
expect.assertions(1);
await expect(buildStaticStandalone(optionsWithInvalidStaticDir)).rejects.toThrow(
"Won't copy root directory. Check your staticDirs!"
);
});
});
});