Fix tests

Signed-off-by: Juan Escalada <juanescalada175@gmail.com>
This commit is contained in:
Juan Escalada
2024-11-26 12:17:58 +09:00
parent da94fabdac
commit 6d6402a974
@@ -323,6 +323,24 @@ describe('buildApiReports', () => {
expect(buildDocs).not.toHaveBeenCalled();
});
it('should throw an error if a path does not exist', async () => {
const paths = ['packages/package-a', 'packages/package-c'];
const opts = {};
await expect(buildApiReports(paths, opts)).rejects.toThrow(
'Invalid paths provided: packages/package-c',
);
});
it('should throw an error if an option is malformed', async () => {
const paths = ['ae-undocumented'];
const opts = {
omitMessages: 'ae-wrong-input-file-type,',
};
await expect(buildApiReports(paths, opts)).rejects.toThrow(
'Invalid paths provided: ae-undocumented',
);
});
});
describe('allowWarnings', () => {
it('should accept single path value', async () => {
@@ -473,17 +491,6 @@ describe('buildApiReports', () => {
outputDir: mockDir.resolve('node_modules/.cache/api-extractor'),
});
});
it('should throw an error if omitMessages ends with a comma', async () => {
const opts = {
omitMessages: 'ae-missing-release-tag,',
};
const paths = ['packages/*'];
await expect(buildApiReports(paths, opts)).rejects.toThrow(
`Invalid value for --omit-messages: ${opts.omitMessages}\nMust be a comma-separated list of strings without spaces or wrapped in quotations.`,
);
});
});
describe('isCI', () => {
it('should set localBuild to false if CI option is passed', async () => {