Skip to content

Commit

Permalink
fix codesmells
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni committed Sep 27, 2023
1 parent 7e252c4 commit 1cadff2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions test/templateConfigValidator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Template Configuration Validator', () => {
}
}
};
expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('This template doesn\'t have the following params: tsets.\nDid you mean \"test\" instead of \"tsets\"?');
expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('This template doesn\'t have the following params: tsets.\nDid you mean "test" instead of "tsets"?');
});

it('Validation throw error if provided param is not supported by the template as template has no params specified', () => {
Expand Down Expand Up @@ -186,7 +186,7 @@ describe('Template Configuration Validator', () => {
}
};

expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('Server \"dummy-mqtt\" uses the mqtt protocol but this template only supports the following ones: myprotocol.');
expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('Server "dummy-mqtt" uses the mqtt protocol but this template only supports the following ones: myprotocol.');
});

describe('should work with v2 apiVersion', () => {
Expand All @@ -196,6 +196,8 @@ describe('Template Configuration Validator', () => {
const { document } = await parse(dummyYAML, {}, {templateConfig: {apiVersion: 'v2'}});
asyncapiDocument = document;
});

// eslint-disable-next-line sonarjs/no-identical-functions
it('Validation throw error if specified server is not in asyncapi document', () => {
const templateParams = {
server: 'myserver'
Expand All @@ -211,6 +213,7 @@ describe('Template Configuration Validator', () => {
expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('Couldn\'t find server with name myserver.');
});

// eslint-disable-next-line sonarjs/no-identical-functions
it('Validation throw error if given protocol is not supported by template', () => {
const templateParams = {
server: 'dummy-mqtt'
Expand All @@ -224,7 +227,7 @@ describe('Template Configuration Validator', () => {
}
};

expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('Server \"dummy-mqtt\" uses the mqtt protocol but this template only supports the following ones: myprotocol.');
expect(() => validateTemplateConfig(templateConfig, templateParams, asyncapiDocument)).toThrow('Server "dummy-mqtt" uses the mqtt protocol but this template only supports the following ones: myprotocol.');
});
});
});

0 comments on commit 1cadff2

Please sign in to comment.