Skip to content

Commit

Permalink
Fix/test title validation (#164)
Browse files Browse the repository at this point in the history
* added validation for test titles

* fixed title validation
  • Loading branch information
DavertMik committed Jul 5, 2024
1 parent f2895c5 commit ccb9d77
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
11 changes: 0 additions & 11 deletions src/decorator.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ class Decorator {
validate() {
const errors = [];

this.getSuiteNames()
.map(s => s.split(':'))
.flat()
.filter(t => {
if (!t) return false;
return !t.replace(/(@[\w:-]+)/g, '').trim();
})
.forEach(t => {
errors.push(`Suite name is empty: '${t}'`);
});

this.getTests()
.filter(t => {
return !t.name.replace(/(@[\w:-]+)/g, '').trim();
Expand Down
3 changes: 1 addition & 2 deletions tests/decorator_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('Decorator', () => {

it('should validate tests with empty titles', () => {
const decorator = new Decorator([
{ name: 'test1', suites: ['Appium', '@suiteTag', 'second'] },
{ name: 'test1', suites: ['Appium', 'second'] },
{ name: '@first-Tag', suites: ['Appium'] },
{ name: '@tag1 @tag2', suites: ['Appium'] },
{ name: 'word @tag1 @tag2', suites: ['Appium'] },
Expand All @@ -48,7 +48,6 @@ describe('Decorator', () => {
// console.log(err.message)
expect(err.message).to.include('@first-Tag');
expect(err.message).to.include('@tag1 @tag2');
expect(err.message).to.include('@suiteTag');
expect(err.message).not.to.include('@tag1 word @tag2');
expect(err.message).not.to.include('word @tag1 @tag2');
expect(err.message).not.to.include('okword');
Expand Down

0 comments on commit ccb9d77

Please sign in to comment.