-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: enable offline mode * fix: include all schema * fix: review comments
- Loading branch information
1 parent
cdbbd0b
commit 5a28f9f
Showing
32 changed files
with
11,173 additions
and
108 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
export { | ||
getContext, | ||
isContext, | ||
getCDNBaseUrl, | ||
initializeManifestData, | ||
initializeUI5YamlData, | ||
|
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
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
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,57 @@ | ||
import { restore, fake } from "sinon"; | ||
import { join } from "path"; | ||
import proxyquire from "proxyquire"; | ||
import { expect } from "chai"; | ||
import { getCDNBaseUrl } from "../../src/utils/ui5"; | ||
|
||
describe("ui5", () => { | ||
afterEach(() => { | ||
restore(); | ||
}); | ||
context("getCDNBaseUrl", () => { | ||
it("get CDN without local url [with version]", async () => { | ||
const result = await getCDNBaseUrl("SAPUI5", "1.111.0"); | ||
expect(result).to.be.equal("https://ui5.sap.com/1.111.0/"); | ||
}); | ||
it("get CDN without local url [without version]", async () => { | ||
const result = await getCDNBaseUrl("SAPUI5", undefined); | ||
expect(result).to.be.equal("https://ui5.sap.com/"); | ||
}); | ||
it("get CDN with local url", async () => { | ||
const filePath = join(__dirname, "..", "..", "src", "utils", "ui5"); | ||
const fakeGetLocalUrl = fake.returns("http://localhost:3000/1.111.0/"); | ||
const fakeTryFetch = fake.resolves({ ok: true }); | ||
const ui5Module = proxyquire | ||
.noPreserveCache() | ||
.noCallThru() | ||
.load(filePath, { | ||
"@ui5-language-assistant/logic-utils": { | ||
getLocalUrl: fakeGetLocalUrl, | ||
tryFetch: fakeTryFetch, | ||
}, | ||
}); | ||
const result = await ui5Module.getCDNBaseUrl("SAPUI5", "1.111.0"); | ||
expect(fakeGetLocalUrl).to.have.been.called; | ||
expect(fakeTryFetch).to.have.been.called; | ||
expect(result).to.be.equal("http://localhost:3000/1.111.0/"); | ||
}); | ||
it("get CDN with local url [fetch not responding => fall back to public]", async () => { | ||
const filePath = join(__dirname, "..", "..", "src", "utils", "ui5"); | ||
const fakeGetLocalUrl = fake.returns("http://localhost:3000/1.111.0/"); | ||
const fakeTryFetch = fake.resolves(undefined); | ||
const ui5Module = proxyquire | ||
.noPreserveCache() | ||
.noCallThru() | ||
.load(filePath, { | ||
"@ui5-language-assistant/logic-utils": { | ||
getLocalUrl: fakeGetLocalUrl, | ||
tryFetch: fakeTryFetch, | ||
}, | ||
}); | ||
const result = await ui5Module.getCDNBaseUrl("SAPUI5", "1.111.0"); | ||
expect(fakeGetLocalUrl).to.have.been.called; | ||
expect(fakeTryFetch).to.have.been.called; | ||
expect(result).to.be.equal("https://ui5.sap.com/1.111.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
Oops, something went wrong.