



















@@ -7,6 +7,14 @@ import {
77listBundledPluginPackArtifacts,
88} from "../../scripts/lib/bundled-plugin-build-entries.mjs";
9910+function expectNoPrefixMatches(values: string[], prefix: string) {
11+expect(values.filter((value) => value.startsWith(prefix))).toEqual([]);
12+}
13+14+function expectSomePrefixMatch(values: string[], prefix: string) {
15+expect(values.filter((value) => value.startsWith(prefix)).length).toBeGreaterThan(0);
16+}
17+1018describe("bundled plugin build entries", () => {
1119const bundledChannelEntrySources = ["index.ts", "channel-entry.ts", "setup-entry.ts"];
1220const forEachBundledChannelEntry = (
@@ -77,31 +85,21 @@ describe("bundled plugin build entries", () => {
7785it("keeps private QA bundles out of required npm pack artifacts", () => {
7886const artifacts = listBundledPluginPackArtifacts();
798780-expect(artifacts.some((artifact) => artifact.startsWith("dist/extensions/qa-channel/"))).toBe(
81-false,
82-);
83-expect(artifacts.some((artifact) => artifact.startsWith("dist/extensions/qa-lab/"))).toBe(
84-false,
85-);
86-expect(artifacts.some((artifact) => artifact.startsWith("dist/extensions/qa-matrix/"))).toBe(
87-false,
88-);
88+expectNoPrefixMatches(artifacts, "dist/extensions/qa-channel/");
89+expectNoPrefixMatches(artifacts, "dist/extensions/qa-lab/");
90+expectNoPrefixMatches(artifacts, "dist/extensions/qa-matrix/");
8991});
90929193it("keeps explicitly downloadable plugins out of bundled package artifacts", () => {
9294const entries = listBundledPluginBuildEntries();
9395const artifacts = listBundledPluginPackArtifacts();
94969597for (const pluginId of ["acpx", "googlechat", "line"]) {
96-expect(
97-Object.keys(entries).some((entry) => entry.startsWith(`extensions/${pluginId}/`)),
98-).toBe(true);
99-expect(
100-artifacts.some((artifact) => artifact.startsWith(`dist/extensions/${pluginId}/`)),
101-).toBe(false);
98+expectSomePrefixMatch(Object.keys(entries), `extensions/${pluginId}/`);
99+expectNoPrefixMatches(artifacts, `dist/extensions/${pluginId}/`);
102100}
103-expect(Object.keys(entries).some((entry) => entry.startsWith("extensions/qqbot/"))).toBe(false);
104-expect(artifacts.some((artifact) => artifact.startsWith("dist/extensions/qqbot/"))).toBe(false);
101+expectNoPrefixMatches(Object.keys(entries), "extensions/qqbot/");
102+expectNoPrefixMatches(artifacts, "dist/extensions/qqbot/");
105103});
106104107105it("keeps bundled channel secret contracts on packed top-level sidecars", () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。