-
Notifications
You must be signed in to change notification settings - Fork 4
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
1 parent
7a5dfe4
commit 9616090
Showing
4 changed files
with
50 additions
and
9 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
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
const ord = require("../lib/ord"); | ||
const private_csn = require("./__mocks__/privateResourcesCsn.json"); | ||
const internal_csn = require("./__mocks__/internalResourcesCsn.json"); | ||
|
||
|
||
// Mock the @sap/cds module | ||
jest.mock("@sap/cds", () => { | ||
const path = require("path"); | ||
let cds = jest.requireActual("@sap/cds"); | ||
cds.root = path.join(__dirname, "bookshop"); | ||
|
||
return cds; | ||
}); | ||
|
||
jest.mock("../lib/date", () => ({ | ||
getRFC3339Date: jest.fn(() => "2024-11-04T14:33:25+01:00"), | ||
})); | ||
|
||
jest.mock("../lib/extendOrdWithCustom", () => ({ | ||
extendCustomORDContentIfExists: jest.fn( | ||
(_appConfig, ordContent, _lazyLogger) => { | ||
console.log( | ||
"The custom.ord.json file is not considered for the purpose of this test." | ||
); | ||
return ordContent; | ||
} | ||
), | ||
})); | ||
|
||
describe("Tests for ORD document when there is no public service", () => { | ||
test("Private services: Successfully create ORD Documents without packages, empty apiResources and eventResources lists", () => { | ||
const document = ord(private_csn); | ||
|
||
expect(document.packages).not.toBeDefined(); | ||
expect(document.apiResources).toHaveLength(0); | ||
expect(document.eventResources).toHaveLength(0); | ||
}); | ||
|
||
test("Internal services: Successfully create ORD Documents without packages, empty apiResources and eventResources lists", () => { | ||
const document = ord(internal_csn); | ||
|
||
expect(document.packages).not.toBeDefined(); | ||
expect(document.apiResources).toHaveLength(0); | ||
expect(document.eventResources).toHaveLength(0); | ||
}); | ||
}); |
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