Files
blap/modules/banner/src/index.test.ts
T
Michael Telatynski 44c540eca0 Tweak modules to be disabled if config is missing (#33806)
* Consolidate modules vitest coverage

* Use vite-common as base for modules vitest config

* Make knip happier

* Fix coverage paths

* Place modules unit tests alongside src

* Switch to defineProject for better type safety

* Consolidate vitest CI & coverage

Kills off vite-common

* Update comment

* Update lockfile

* Fix shared-components vitest config

* Soften eslint config for tests in modules

* Run eslint on modules/playwright dir too

* Make tsc happy

* Tweak modules to be disabled if config is missing

* Restore blank line

* Improve coverage

* Potential fix for pull request finding 'Unused variable, import, function or class'

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-06-16 08:41:40 +00:00

36 lines
898 B
TypeScript

/*
Copyright 2026 Element Creations Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { describe, expect, it, vi } from "vitest";
import { type Api } from "@element-hq/element-web-module-api";
import BannerModule from "./index";
const makeApi = (config: unknown): Api => {
return {
config: {
get: vi.fn().mockReturnValue(config),
},
i18n: {
register: vi.fn(),
},
} as unknown as Api;
};
describe("BannerModule", () => {
describe("load", () => {
it("should do nothing if no config present", async () => {
const api = makeApi(null);
const module = new BannerModule(api);
await module.load();
expect(api.i18n.register).not.toHaveBeenCalled();
});
});
});