Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/loopover-extension/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ function renderActions(body, actions) {
}

if (globalThis.__LOOPOVER_EXTENSION_TEST__) {
globalThis.__gittensoryContentInternals = {
globalThis.__loopoverContentInternals = {
matchGitHubPageTarget,
matchPullRequestTarget,
renderPullContext,
Expand Down
6 changes: 3 additions & 3 deletions apps/loopover-miner-extension/background.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "./opportunity-badge.js";
import "./toolbar-badge.js";

const badgeApi = globalThis.__gittensoryMinerOpportunityBadge;
const toolbarBadgeApi = globalThis.__gittensoryMinerToolbarBadge;
const badgeApi = globalThis.__loopoverMinerOpportunityBadge;
const toolbarBadgeApi = globalThis.__loopoverMinerToolbarBadge;

const PING_MESSAGE = "gittensory-miner:ping";
const ISSUE_CONTEXT_MESSAGE = "gittensory-miner:issue-context";
Expand Down Expand Up @@ -172,7 +172,7 @@ if (chrome.action && chrome.storage.onChanged) {
}

if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) {
globalThis.__gittensoryMinerBackgroundInternals = {
globalThis.__loopoverMinerBackgroundInternals = {
PING_MESSAGE,
ISSUE_CONTEXT_MESSAGE,
SYNC_RANKED_CANDIDATES_MESSAGE,
Expand Down
4 changes: 2 additions & 2 deletions apps/loopover-miner-extension/content.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const badgeApi = globalThis.__gittensoryMinerOpportunityBadge;
const badgeApi = globalThis.__loopoverMinerOpportunityBadge;

const target = matchGitHubIssueTarget(location.pathname);

Expand Down Expand Up @@ -69,7 +69,7 @@ function renderOpportunityBadge(container, payload, nowMs = Date.now()) {
}

if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) {
globalThis.__gittensoryMinerContentInternals = {
globalThis.__loopoverMinerContentInternals = {
matchGitHubIssueTarget,
findIssueSidebar,
renderOpportunityBadge,
Expand Down
4 changes: 2 additions & 2 deletions apps/loopover-miner-extension/opportunity-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ const opportunityBadgeApi = {
renderOpportunityBadgeMarkup,
};

globalThis.__gittensoryMinerOpportunityBadge = opportunityBadgeApi;
globalThis.__loopoverMinerOpportunityBadge = opportunityBadgeApi;

if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) {
globalThis.__gittensoryMinerOpportunityBadgeTestExports = opportunityBadgeApi;
globalThis.__loopoverMinerOpportunityBadgeTestExports = opportunityBadgeApi;
}
2 changes: 1 addition & 1 deletion apps/loopover-miner-extension/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function normalizeMinerUiUrl(text) {
}

if (globalThis.__LOOPOVER_MINER_EXTENSION_TEST__) {
globalThis.__gittensoryMinerOptionsInternals = {
globalThis.__loopoverMinerOptionsInternals = {
parseWatchedRepos,
parseRankedCandidatesJson,
removeLegacyDiscoveryIndexUrl,
Expand Down
6 changes: 3 additions & 3 deletions apps/loopover-miner-extension/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,10 @@ export async function loadExtensionModules(options: ChromeMockOptions = {}) {

return {
...harness,
opportunityExports: globalThis.__gittensoryMinerOpportunityBadgeTestExports as OpportunityBadgeExports,
toolbarApi: globalThis.__gittensoryMinerToolbarBadge as {
opportunityExports: globalThis.__loopoverMinerOpportunityBadgeTestExports as OpportunityBadgeExports,
toolbarApi: globalThis.__loopoverMinerToolbarBadge as {
computeToolbarBadge: (rankedCandidates: unknown) => { text: string; backgroundColor: string };
},
backgroundInternals: globalThis.__gittensoryMinerBackgroundInternals as BackgroundInternals,
backgroundInternals: globalThis.__loopoverMinerBackgroundInternals as BackgroundInternals,
};
}
4 changes: 2 additions & 2 deletions apps/loopover-miner-extension/toolbar-badge.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ export function computeToolbarBadge(rankedCandidates) {
}

// Expose on a global too — the background service worker reads this the same way it reads
// `__gittensoryMinerOpportunityBadge`, so the extension's VM-based test harness (which cannot evaluate ESM
// `__loopoverMinerOpportunityBadge`, so the extension's VM-based test harness (which cannot evaluate ESM
// `import` bindings) can drive it without a module loader.
globalThis.__gittensoryMinerToolbarBadge = {
globalThis.__loopoverMinerToolbarBadge = {
computeToolbarBadge,
TOOLBAR_BADGE_HAS_DATA_COLOR,
TOOLBAR_BADGE_EMPTY_COLOR,
Expand Down
2 changes: 1 addition & 1 deletion test/unit/extension-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function loadContentInternals() {
context.globalThis = context;
const vmContext = createContext(context);
new Script(contentScript).runInContext(vmContext);
return vmContext.__gittensoryContentInternals as {
return vmContext.__loopoverContentInternals as {
matchGitHubPageTarget: (
pathname: string,
) => { kind: "pull_request"; owner: string; repo: string; pullNumber: number } | { kind: "issue"; owner: string; repo: string; issueNumber: number } | null;
Expand Down
12 changes: 6 additions & 6 deletions test/unit/miner-extension-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ describe("miner extension opportunity badge", () => {
new Script(optionsScript).runInContext(vmContext);
await flushPromises();

const internals = vmContext.__gittensoryMinerOptionsInternals as { MAX_RANKED_CANDIDATES_JSON_BYTES: number };
const internals = vmContext.__loopoverMinerOptionsInternals as { MAX_RANKED_CANDIDATES_JSON_BYTES: number };
elements["#rankedCandidatesJson"].value = "x".repeat(internals.MAX_RANKED_CANDIDATES_JSON_BYTES + 1);
await elements["#settings"].dispatchSubmit();

Expand Down Expand Up @@ -487,7 +487,7 @@ function loadBadgeInternals() {
context.globalThis = context;
const vmContext = createContext(context);
new Script(badgeScript).runInContext(vmContext);
return vmContext.__gittensoryMinerOpportunityBadgeTestExports as {
return vmContext.__loopoverMinerOpportunityBadgeTestExports as {
lookupRankedOpportunity: (ranked: unknown[], repoFullName: string, issueNumber: number) => Record<string, unknown> | null;
formatOpportunityBadge: (entry: Record<string, unknown>) => { tier: string; score: string; why: string };
formatLastSyncedLabel: (savedAt: unknown, nowMs: number) => string | null;
Expand All @@ -502,7 +502,7 @@ function loadContentInternals() {
const badge = loadBadgeInternals();
const context: Record<string, unknown> = {
__LOOPOVER_MINER_EXTENSION_TEST__: true,
__gittensoryMinerOpportunityBadge: badge,
__loopoverMinerOpportunityBadge: badge,
location: { pathname: "/JSONbored/gittensory/pull/146" },
document: {
querySelector: () => null,
Expand All @@ -514,7 +514,7 @@ function loadContentInternals() {
context.globalThis = context;
const vmContext = createContext(context);
new Script(contentScript).runInContext(vmContext);
return vmContext.__gittensoryMinerContentInternals as {
return vmContext.__loopoverMinerContentInternals as {
matchGitHubIssueTarget: (
pathname: string,
) => { kind: "issue"; owner: string; repo: string; issueNumber: number } | null;
Expand Down Expand Up @@ -550,7 +550,7 @@ function loadBackgroundInternals({
new Script(badgeScript).runInContext(vmContext);
const backgroundForTest = backgroundScript.replace(/^import\s+["'][^"']+["'];\s*/gm, "");
new Script(backgroundForTest).runInContext(vmContext);
return vmContext.__gittensoryMinerBackgroundInternals as {
return vmContext.__loopoverMinerBackgroundInternals as {
loadIssueOpportunityContext: (message: {
owner: string;
repo: string;
Expand Down Expand Up @@ -579,7 +579,7 @@ function loadOptionsInternals() {
context.globalThis = context;
const vmContext = createContext(context);
new Script(optionsScript).runInContext(vmContext);
return vmContext.__gittensoryMinerOptionsInternals as {
return vmContext.__loopoverMinerOptionsInternals as {
parseWatchedRepos: (text: string) => string[];
parseRankedCandidatesJson: (text: string) => unknown[];
removeLegacyDiscoveryIndexUrl: () => Promise<void>;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/miner-extension-live-fetch.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function loadBackgroundWithFakeChrome({
const vmContext = createContext(context);
new Script(backgroundScriptForVm()).runInContext(vmContext);

const internals = vmContext.__gittensoryMinerBackgroundInternals as {
const internals = vmContext.__loopoverMinerBackgroundInternals as {
SYNC_RANKED_CANDIDATES_MESSAGE: string;
DEFAULT_MINER_UI_URL: string;
loadMinerUiUrl: () => Promise<string>;
Expand Down
2 changes: 1 addition & 1 deletion test/unit/miner-toolbar-badge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ function loadBackground(
new Script(opportunityBadgeScript).runInContext(vmContext);
new Script(toolbarBadgeScript).runInContext(vmContext);
new Script(backgroundScript).runInContext(vmContext);
const internals = vmContext.__gittensoryMinerBackgroundInternals as {
const internals = vmContext.__loopoverMinerBackgroundInternals as {
refreshToolbarBadge: () => Promise<void>;
};
return {
Expand Down
Loading