feat: enhance CI workflow and update webapp styles
Some checks failed
CI / lint-and-test (push) Failing after 45s
Some checks failed
CI / lint-and-test (push) Failing after 45s
- Added Node.js setup and webapp testing steps to the CI workflow for improved integration. - Updated HTML to link multiple CSS files for better modularity and organization of styles. - Removed deprecated `style.css` and introduced new CSS files for base styles, calendar, day detail, hints, markers, states, and duty list to enhance maintainability and readability. - Implemented new styles for improved presentation of duty information and user interactions. - Added unit tests for new API functions and contact link rendering to ensure functionality and reliability.
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
getTgWebAppDataFromHash,
|
||||
getInitData,
|
||||
isLocalhost,
|
||||
hasTelegramHashButNoInitData,
|
||||
} from "./auth.js";
|
||||
|
||||
describe("getTgWebAppDataFromHash", () => {
|
||||
@@ -98,3 +99,57 @@ describe("isLocalhost", () => {
|
||||
expect(isLocalhost()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("hasTelegramHashButNoInitData", () => {
|
||||
const origLocation = window.location;
|
||||
|
||||
afterEach(() => {
|
||||
window.location = origLocation;
|
||||
});
|
||||
|
||||
it("returns false when hash is empty", () => {
|
||||
delete window.location;
|
||||
window.location = { ...origLocation, hash: "", search: "" };
|
||||
expect(hasTelegramHashButNoInitData()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns true when hash has tgWebAppVersion but no tgWebAppData", () => {
|
||||
delete window.location;
|
||||
window.location = {
|
||||
...origLocation,
|
||||
hash: "#tgWebAppVersion=6",
|
||||
search: "",
|
||||
};
|
||||
expect(hasTelegramHashButNoInitData()).toBe(true);
|
||||
});
|
||||
|
||||
it("returns false when hash has both tgWebAppVersion and tgWebAppData", () => {
|
||||
delete window.location;
|
||||
window.location = {
|
||||
...origLocation,
|
||||
hash: "#tgWebAppVersion=6&tgWebAppData=some%3Ddata",
|
||||
search: "",
|
||||
};
|
||||
expect(hasTelegramHashButNoInitData()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when hash has tgWebAppData in unencoded form (with & and =)", () => {
|
||||
delete window.location;
|
||||
window.location = {
|
||||
...origLocation,
|
||||
hash: "#tgWebAppData=value&tgWebAppVersion=6",
|
||||
search: "",
|
||||
};
|
||||
expect(hasTelegramHashButNoInitData()).toBe(false);
|
||||
});
|
||||
|
||||
it("returns false when hash has no Telegram params", () => {
|
||||
delete window.location;
|
||||
window.location = {
|
||||
...origLocation,
|
||||
hash: "#other=param",
|
||||
search: "",
|
||||
};
|
||||
expect(hasTelegramHashButNoInitData()).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user