






















@@ -1,10 +1,12 @@
11import { beforeEach, describe, expect, it, vi } from "vitest";
2233const getBundledChannelPluginMock = vi.hoisted(() => vi.fn());
4+const hasBundledChannelPackageSetupFeatureMock = vi.hoisted(() => vi.fn());
45const getLoadedChannelPluginMock = vi.hoisted(() => vi.fn());
5667vi.mock("./bundled.js", () => ({
78getBundledChannelPlugin: getBundledChannelPluginMock,
9+hasBundledChannelPackageSetupFeature: hasBundledChannelPackageSetupFeatureMock,
810}));
9111012vi.mock("./registry.js", () => ({
@@ -19,6 +21,8 @@ import {
1921describe("setup promotion helpers", () => {
2022beforeEach(() => {
2123getBundledChannelPluginMock.mockReset();
24+hasBundledChannelPackageSetupFeatureMock.mockReset();
25+hasBundledChannelPackageSetupFeatureMock.mockReturnValue(false);
2226getLoadedChannelPluginMock.mockReset();
2327});
2428@@ -38,9 +42,9 @@ describe("setup promotion helpers", () => {
3842expect(getBundledChannelPluginMock).not.toHaveBeenCalled();
3943});
404441-it("keeps WhatsApp static promotion cheap even when named accounts already exist", () => {
45+it("skips bundled setup promotion without a manifest feature", () => {
4246const keys = resolveSingleAccountKeysToMove({
43-channelKey: "whatsapp",
47+channelKey: "demo",
4448channel: {
4549accounts: {
4650work: { enabled: true },
@@ -53,11 +57,16 @@ describe("setup promotion helpers", () => {
5357});
54585559expect(keys).toEqual(["dmPolicy", "allowFrom", "groupPolicy", "groupAllowFrom"]);
56-expect(getLoadedChannelPluginMock).toHaveBeenCalledWith("whatsapp");
60+expect(getLoadedChannelPluginMock).toHaveBeenCalledWith("demo");
61+expect(hasBundledChannelPackageSetupFeatureMock).toHaveBeenCalledWith(
62+"demo",
63+"configPromotion",
64+);
5765expect(getBundledChannelPluginMock).not.toHaveBeenCalled();
5866});
59676068it("loads bundled setup only for non-static migration keys", () => {
69+hasBundledChannelPackageSetupFeatureMock.mockReturnValue(true);
6170getBundledChannelPluginMock.mockReturnValue({
6271setup: {
6372singleAccountKeysToMove: ["customAuth"],
@@ -96,6 +105,7 @@ describe("setup promotion helpers", () => {
96105});
9710698107it("loads bundled setup for named-account filters before registry bootstrap", () => {
108+hasBundledChannelPackageSetupFeatureMock.mockReturnValue(true);
99109getBundledChannelPluginMock.mockReturnValue({
100110setup: {
101111namedAccountPromotionKeys: ["token"],
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。