Skip to content

Commit 28b8f59

Browse files
henrymercerCopilot
andcommitted
Use shared test state for bundle eligibility
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent 5a2f29e commit 28b8f59

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎src/per-language-bundles.test.ts‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from "ava";
22

33
import { BundlePlatform } from "./bundle-platform";
4-
import { ActionsEnvVars, ReadOnlyEnv } from "./environment";
4+
import { ActionsEnvVars, Env } from "./environment";
55
import { Feature } from "./feature-flags";
66
import { BuiltInLanguage } from "./languages";
77
import {
@@ -13,6 +13,7 @@ import {
1313
createFeatures,
1414
getRecordingLogger,
1515
getTestEnv,
16+
initAllState,
1617
LoggedMessage,
1718
} from "./testing-utils";
1819
import { GitHubVariant } from "./util";
@@ -30,16 +31,16 @@ const ELIGIBLE_OPTIONS: PerLanguageBundleOptions = {
3031
async function checkEligibility(
3132
overrides: Partial<PerLanguageBundleOptions>,
3233
enabledFeatures: Feature[] = [Feature.PerLanguageBundles],
33-
env: ReadOnlyEnv = getTestEnv({
34+
env: Env = getTestEnv({
3435
[ActionsEnvVars.RUNNER_ENVIRONMENT]: "github-hosted",
3536
}),
3637
) {
3738
return getPerLanguageBundleLanguage(
38-
{
39+
initAllState({
3940
env,
4041
features: createFeatures(enabledFeatures),
4142
logger: getRecordingLogger([], { logToConsole: false }),
42-
},
43+
}),
4344
{ ...ELIGIBLE_OPTIONS, ...overrides },
4445
);
4546
}
@@ -130,11 +131,11 @@ test("getPerLanguageBundleLanguage requires the feature flag", async (t) => {
130131
test("getPerLanguageBundleLanguage explains a disabled feature before checking eligibility", async (t) => {
131132
const messages: LoggedMessage[] = [];
132133
const language = await getPerLanguageBundleLanguage(
133-
{
134+
initAllState({
134135
env: getTestEnv(),
135136
features: createFeatures([]),
136137
logger: getRecordingLogger(messages, { logToConsole: false }),
137-
},
138+
}),
138139
{ ...ELIGIBLE_OPTIONS, rawLanguages: undefined, cliVersion: undefined },
139140
);
140141

0 commit comments

Comments
 (0)