Skip to content

Commit

Permalink
test: Refactor UI5YamlLinter test
Browse files Browse the repository at this point in the history
  • Loading branch information
maxreichmann committed Apr 10, 2024
1 parent d3adbc1 commit b2fde65
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions test/lib/linter/UI5YamlLinter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ framework:
name: OpenUI5
version: "1.121.0"
libraries:
- name: sap.ca.scfld.md
- name: sap.ca.scfld.md
- name: sap.ca.ui
- name: sap.fe.common`;

Expand All @@ -28,10 +28,26 @@ framework:

// Test returned messages
t.is(messages.length, 3, "Detection of 3 deprecated libraries expected");
for (const m of messages) {
t.is(m.ruleId, "ui5-linter-no-deprecated-api",
`Rule ID 'ui5-linter-no-deprecated-api' of message '${m.message}' expected`);
t.is(typeof m.column, "number", `'Column' value of message '${m.message}' should be a number`);
t.is(typeof m.line, "number", `'Line' value of message '${m.message}' should be a number`);
}

// Test each message

Check failure on line 32 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
t.is(messages[0].ruleId, "ui5-linter-no-deprecated-api",

Check failure on line 33 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
`RuleId is correct`);
t.is(messages[0].message, `Use of deprecated library 'sap.ca.scfld.md'`,

Check failure on line 35 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
`Message is correct`);
t.is(messages[0].column, 7, `Column is correct`);

Check failure on line 37 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
t.is(messages[0].line, 9, `Line is correct`);

Check failure on line 38 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces

t.is(messages[1].ruleId, "ui5-linter-no-deprecated-api",

Check failure on line 40 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
`RuleId is correct`);
t.is(messages[1].message, `Use of deprecated library 'sap.ca.ui'`,

Check failure on line 42 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
`Message is correct`);
t.is(messages[1].column, 7, `Column is correct`);

Check failure on line 44 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
t.is(messages[1].line, 10, `Line is correct`);

Check failure on line 45 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces

t.is(messages[2].ruleId, "ui5-linter-no-deprecated-api",

Check failure on line 47 in test/lib/linter/UI5YamlLinter.ts

View workflow job for this annotation

GitHub Actions / General checks, tests and coverage reporting

Expected indentation of 1 tab but found 2 spaces
`RuleId is correct`);
t.is(messages[2].message, `Use of deprecated library 'sap.fe.common'`,
`Message is correct`);
t.is(messages[2].column, 7, `Column is correct`);
t.is(messages[2].line, 11, `Line is correct`);
});

0 comments on commit b2fde65

Please sign in to comment.