Skip to content

Commit

Permalink
refactor: Split library.js fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
d3xter666 committed Mar 22, 2024
1 parent 06710a5 commit 56193e0
Show file tree
Hide file tree
Showing 4 changed files with 176 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,4 @@ sap.ui.define([
Library.init({
apiVersion: "2"
});
Library.init({
apiVersion: 2
});

// Should be ignored
Library.load({
apiVersion: 23
});
});
17 changes: 17 additions & 0 deletions test/fixtures/linter/rules/NoDeprecatedApi/library_negative.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*!
* ${copyright}
*/
sap.ui.define([
"sap/ui/core/Lib",
], function (Library) {
"use strict";

Library.init({
apiVersion: 2
});

// Should be ignored
Library.load({
apiVersion: 23
});
});
231 changes: 159 additions & 72 deletions test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,93 @@ Generated by [AVA](https://avajs.dev).
},
]

## General: library.js

> Snapshot 1
[
{
coverageInfo: [],
errorCount: 7,
fatalErrorCount: 0,
filePath: 'library.js',
messages: [
{
column: 2,
fatal: undefined,
line: 9,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 10,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 11,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 12,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 16,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 19,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 22,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
],
warningCount: 0,
},
]

## General: library_negative.js

> Snapshot 1
[
{
coverageInfo: [],
errorCount: 0,
fatalErrorCount: 0,
filePath: 'library_negative.js',
messages: [],
warningCount: 0,
},
]

## General: manifest.json

> Snapshot 1
Expand Down Expand Up @@ -1018,78 +1105,6 @@ Generated by [AVA](https://avajs.dev).
},
]

## General: old_library.js

> Snapshot 1
[
{
coverageInfo: [],
errorCount: 7,
fatalErrorCount: 0,
filePath: 'old_library.js',
messages: [
{
column: 2,
fatal: undefined,
line: 9,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 10,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 11,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 12,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 16,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 19,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 22,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
],
warningCount: 0,
},
]

## General: sap.ui.jsview.js

> Snapshot 1
Expand Down Expand Up @@ -1164,3 +1179,75 @@ Generated by [AVA](https://avajs.dev).
warningCount: 0,
},
]

## General: old_library.js

> Snapshot 1
[
{
coverageInfo: [],
errorCount: 7,
fatalErrorCount: 0,
filePath: 'old_library.js',
messages: [
{
column: 2,
fatal: undefined,
line: 9,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 10,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 11,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 2,
fatal: undefined,
line: 12,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 16,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 19,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
{
column: 15,
fatal: undefined,
line: 22,
message: 'Call to Library.init() must be declared with property {apiVersion: 2}',
ruleId: 'ui5-linter-no-partially-deprecated-api',
severity: 2,
},
],
warningCount: 0,
},
]
Binary file modified test/lib/linter/rules/snapshots/NoDeprecatedApi.ts.snap
Binary file not shown.

0 comments on commit 56193e0

Please sign in to comment.