Fix linting errors after #13392
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -37,7 +37,7 @@ describe('generators', () => {
|
||||
it('should return error if no generator is registered', async () => {
|
||||
const generators = new Generators();
|
||||
|
||||
expect(() => generators.get(mockEntity)).toThrowError(
|
||||
expect(() => generators.get(mockEntity)).toThrow(
|
||||
'No generator registered for entity: "techdocs"',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -462,7 +462,7 @@ describe('helpers', () => {
|
||||
// Check if the file exists
|
||||
await expect(
|
||||
fs.access(filePath, fs.constants.F_OK),
|
||||
).resolves.not.toThrowError();
|
||||
).resolves.not.toThrow();
|
||||
});
|
||||
|
||||
it('should throw error when the JSON is invalid', async () => {
|
||||
@@ -470,7 +470,7 @@ describe('helpers', () => {
|
||||
|
||||
await expect(
|
||||
createOrUpdateMetadata(filePath, mockLogger),
|
||||
).rejects.toThrowError('Unexpected token d in JSON at position 0');
|
||||
).rejects.toThrow('Unexpected token d in JSON at position 0');
|
||||
});
|
||||
|
||||
it('should add build timestamp to the metadata json', async () => {
|
||||
@@ -511,9 +511,9 @@ describe('helpers', () => {
|
||||
it('should throw error when the JSON is invalid', async () => {
|
||||
const filePath = path.join(rootDir, 'invalid_techdocs_metadata.json');
|
||||
|
||||
await expect(
|
||||
storeEtagMetadata(filePath, 'etag123abc'),
|
||||
).rejects.toThrowError('Unexpected token d in JSON at position 0');
|
||||
await expect(storeEtagMetadata(filePath, 'etag123abc')).rejects.toThrow(
|
||||
'Unexpected token d in JSON at position 0',
|
||||
);
|
||||
});
|
||||
|
||||
it('should add etag to the metadata json', async () => {
|
||||
@@ -552,7 +552,7 @@ describe('helpers', () => {
|
||||
|
||||
it('throws when neither .yml nor .yaml file is present', async () => {
|
||||
const invalidInputDir = resolvePath(__filename);
|
||||
await expect(getMkdocsYml(invalidInputDir)).rejects.toThrowError(
|
||||
await expect(getMkdocsYml(invalidInputDir)).rejects.toThrow(
|
||||
/Could not read MkDocs YAML config file mkdocs.yml or mkdocs.yaml for validation/,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -102,9 +102,9 @@ describe('lowerCaseEntityTripletInStoragePath', () => {
|
||||
it('throws error when there is no triplet', () => {
|
||||
const originalPath = '/default/component/IMAGE.png';
|
||||
const error = `Encountered file unmanaged by TechDocs ${originalPath}. Skipping.`;
|
||||
expect(() =>
|
||||
lowerCaseEntityTripletInStoragePath(originalPath),
|
||||
).toThrowError(error);
|
||||
expect(() => lowerCaseEntityTripletInStoragePath(originalPath)).toThrow(
|
||||
error,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ describe('local publisher', () => {
|
||||
|
||||
await expect(() =>
|
||||
publisher.publish({ entity: mockEntity, directory: tmpDir }),
|
||||
).rejects.toThrowError('Unable to publish TechDocs site');
|
||||
).rejects.toThrow('Unable to publish TechDocs site');
|
||||
});
|
||||
|
||||
it('should throw with unsafe name', async () => {
|
||||
@@ -154,7 +154,7 @@ describe('local publisher', () => {
|
||||
|
||||
await expect(() =>
|
||||
publisher.publish({ entity: mockEntity, directory: tmpDir }),
|
||||
).rejects.toThrowError('Unable to publish TechDocs site');
|
||||
).rejects.toThrow('Unable to publish TechDocs site');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -284,7 +284,7 @@ describe('OpenStackSwiftPublish', () => {
|
||||
entity,
|
||||
directory: wrongPathToGeneratedDirectory,
|
||||
}),
|
||||
).rejects.toThrowError();
|
||||
).rejects.toThrow();
|
||||
|
||||
const fails = publisher.publish({
|
||||
entity,
|
||||
|
||||
Reference in New Issue
Block a user