Skip to content

Commit

Permalink
fix: Add tests for the new scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Mar 22, 2024
1 parent 191a23a commit f42ad7a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 1 deletion.
15 changes: 15 additions & 0 deletions test/fixtures/linter/rules/NoDeprecatedApi/library.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,19 @@ sap.ui.define([
Library["init"]({
apiVersion: 1
});

const LibInit = Library.init;
LibInit({
apiVersion: 1
});

const {init} = Library;
init({
apiVersion: 1
});

const {init: intRenames} = Library;
intRenames({
apiVersion: 1
});
});
15 changes: 15 additions & 0 deletions test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,19 @@ sap.ui.define([
Library.load({
apiVersion: 23
});

const LibInit = Library.init;
LibInit({
apiVersion: 2
});

const {init} = Library;
init({
apiVersion: 2
});

const {init: intRenames} = Library;
intRenames({
apiVersion: 2
});
});
26 changes: 25 additions & 1 deletion test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ Generated by [AVA](https://avajs.dev).
[
{
coverageInfo: [],
errorCount: 8,
errorCount: 11,
fatalErrorCount: 0,
filePath: 'library.js',
messages: [
Expand Down Expand Up @@ -863,6 +863,30 @@ Generated by [AVA](https://avajs.dev).
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 30,
message: 'Call to LibInit() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 35,
message: 'Call to init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 40,
message: 'Call to intRenames() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
],
warningCount: 0,
},
Expand Down
Binary file modified test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap
Binary file not shown.

0 comments on commit f42ad7a

Please sign in to comment.