-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
211 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,55 @@ | ||
/* eslint-disable camelcase */ | ||
/* eslint-disable camelcase, no-magic-numbers */ | ||
import { ESLint } from "eslint"; | ||
import { SNUpdateXMLData } from "../../src/core/sn.js"; | ||
import { UpdateXMLScan } from "../../src/linter/UpdateXMLScan.js"; | ||
|
||
describe("NowUpdateXMLScan", () => { | ||
it("should return correct error/warning count for all reports", () => { | ||
const data: SNUpdateXMLData = { | ||
name: "name", | ||
sys_id: "sysId", | ||
action: "INSERT_OR_UPDATE", | ||
type: "sysId", | ||
target_name: "sysId", | ||
update_set: "sysId", | ||
payload: "sysId", | ||
sys_created_by: "sysId", | ||
sys_created_on: "sysId", | ||
sys_updated_by: "sysId", | ||
sys_updated_on: "sysId", | ||
application: "global", | ||
payloadHash: -1234, | ||
sys_mod_count: 0 | ||
}; | ||
describe("UpdateXMLScan", () => { | ||
const data: SNUpdateXMLData = { | ||
name: "name", | ||
sys_id: "sysId", | ||
action: "INSERT_OR_UPDATE", | ||
type: "sysId", | ||
target_name: "sysId", | ||
update_set: "sysId", | ||
payload: "sysId", | ||
sys_created_by: "sysId", | ||
sys_created_on: "sysId", | ||
sys_updated_by: "sysId", | ||
sys_updated_on: "sysId", | ||
application: "global", | ||
payloadHash: -1234, | ||
sys_mod_count: 0 | ||
}; | ||
|
||
it("should return correct error count and status for all reports", () => { | ||
const scan = new UpdateXMLScan(data); | ||
scan.reports.set("script", { | ||
scan.setReport("script", { | ||
warningCount: 1, | ||
errorCount: 2 | ||
}); | ||
scan.reports.set("condition", { | ||
} as ESLint.LintResult); | ||
scan.setReport("condition", { | ||
warningCount: 1, | ||
errorCount: 0 | ||
}); | ||
|
||
} as ESLint.LintResult); | ||
|
||
expect(scan.getReportsWarningCount()).toBe(2); | ||
expect(scan.getReportsErrorCount()).toBe(2); | ||
expect(scan.hasReportsWarnings()).toBe(true); | ||
expect(scan.hasReportsErrors()).toBe(true); | ||
expect(scan.getStatus()).toBe("ERROR"); | ||
}); | ||
|
||
it("should return correct warning count and status for all reports", () => { | ||
const scan = new UpdateXMLScan(data); | ||
scan.setReport("script", { | ||
warningCount: 1, | ||
errorCount: 0 | ||
} as ESLint.LintResult); | ||
scan.setReport("condition", { | ||
warningCount: 3, | ||
errorCount: 0 | ||
} as ESLint.LintResult); | ||
|
||
expect(scan.getReportsWarningCount()).toBe(4); | ||
expect(scan.hasReportsWarnings()).toBe(true); | ||
expect(scan.getStatus()).toBe("WARNING"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.