diff --git a/.tool-versions b/.tool-versions index fc0043ece8e..42dc16f0d63 100644 --- a/.tool-versions +++ b/.tool-versions @@ -12,4 +12,4 @@ awscli 2.4.7 python 3.11.3 system rust 1.68.0 ruby 3.1.3 -pnpm 8.3.0 +pnpm 8.9.2 diff --git a/BUILD.bazel b/BUILD.bazel index 0349639d9dd..55301fd8ba9 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -57,7 +57,7 @@ ts_config( ts_config( name = "tsconfig-all", - src = "tsconfig.all.json", + src = "tsconfig.json", visibility = ["//visibility:public"], deps = [ ":tsconfig", diff --git a/client/browser/BUILD.bazel b/client/browser/BUILD.bazel index b674a09fa80..00690d9c90c 100644 --- a/client/browser/BUILD.bazel +++ b/client/browser/BUILD.bazel @@ -313,6 +313,7 @@ ts_project( ":node_modules/@sourcegraph/common", ":node_modules/@sourcegraph/http-client", ":node_modules/@sourcegraph/shared", + ":node_modules/@sourcegraph/testing", ":node_modules/@sourcegraph/wildcard", #keep ":node_modules/sourcegraph", "//:node_modules/@jest/globals", diff --git a/client/browser/package.json b/client/browser/package.json index 2be1c4069d8..8ffb747b684 100644 --- a/client/browser/package.json +++ b/client/browser/package.json @@ -33,6 +33,7 @@ "devDependencies": { "@sourcegraph/build-config": "workspace:*", "@sourcegraph/extension-api-types": "workspace:*", + "@sourcegraph/testing": "workspace:*", "sourcegraph": "workspace:*" }, "dependencies": { diff --git a/client/browser/src/shared/code-hosts/bitbucket/scrape.test.ts b/client/browser/src/shared/code-hosts/bitbucket/scrape.test.ts index 3b83a237f0d..61fa3a6d6c7 100644 --- a/client/browser/src/shared/code-hosts/bitbucket/scrape.test.ts +++ b/client/browser/src/shared/code-hosts/bitbucket/scrape.test.ts @@ -8,17 +8,22 @@ import { getFileInfoWithoutCommitIDsFromMultiFileDiffCodeView, isCommitsView, isPullRequestView, + windowLocation__testingOnly, } from './scrape' describe('Bitbucket scrape.ts', () => { + afterEach(() => { + windowLocation__testingOnly.value = null + }) + describe('getFileInfoFromSingleFileSourceCodeView()', () => { afterEach(() => { document.body.innerHTML = '' }) it('should get the FileInfo for a single file code view', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOUR/repos/mux/browse/context.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOUR/repos/mux/browse/context.go' + ) document.body.innerHTML = await readFile(`${__dirname}/__fixtures__/single-file.html`, 'utf-8') const codeView = document.querySelector('.file-content') const fileInfo = getFileInfoFromSingleFileSourceCodeView(codeView!) @@ -34,9 +39,9 @@ describe('Bitbucket scrape.ts', () => { }) describe('getDiffFileInfoFromMultiFileDiffCodeView()', () => { it('should get the FileInfo for an added file', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/new_file.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/new_file.go' + ) const codeView = await getFixtureBody({ htmlFixturePath: `${__dirname}/__fixtures__/code-views/pull-request/split/added.html`, isFullDocument: false, @@ -52,9 +57,9 @@ describe('Bitbucket scrape.ts', () => { }) }) it('should get the FileInfo for a modified file', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/mux.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/mux.go' + ) const codeView = await getFixtureBody({ htmlFixturePath: `${__dirname}/__fixtures__/code-views/pull-request/split/modified.html`, isFullDocument: false, @@ -70,9 +75,9 @@ describe('Bitbucket scrape.ts', () => { }) }) it('should get the FileInfo for a deleted file', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/old_test.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/old_test.go' + ) const codeView = await getFixtureBody({ htmlFixturePath: `${__dirname}/__fixtures__/code-views/pull-request/split/deleted.html`, isFullDocument: false, @@ -88,9 +93,9 @@ describe('Bitbucket scrape.ts', () => { }) }) it('should get the FileInfo for a copied file', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/mux.1.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/mux.1.go' + ) const codeView = await getFixtureBody({ htmlFixturePath: `${__dirname}/__fixtures__/code-views/pull-request/split/copied.html`, isFullDocument: false, @@ -106,9 +111,9 @@ describe('Bitbucket scrape.ts', () => { }) }) it('should get the FileInfo for a renamed file', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/mux_test_moved.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/mux_test_moved.go' + ) const codeView = await getFixtureBody({ htmlFixturePath: `${__dirname}/__fixtures__/code-views/pull-request/split/renamed.html`, isFullDocument: false, @@ -124,9 +129,9 @@ describe('Bitbucket scrape.ts', () => { }) }) it('should get the FileInfo for a moved file', async () => { - jsdom.reconfigure({ - url: 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/test-dir/route.go', - }) + windowLocation__testingOnly.value = new URL( + 'https://bitbucket.test/projects/SOURCEGRAPH/repos/mux/pull-requests/1/diff#dir/test-dir/route.go' + ) const codeView = await getFixtureBody({ htmlFixturePath: `${__dirname}/__fixtures__/code-views/pull-request/split/moved.html`, isFullDocument: false, diff --git a/client/browser/src/shared/code-hosts/bitbucket/scrape.ts b/client/browser/src/shared/code-hosts/bitbucket/scrape.ts index 2ef64157583..6bd9ab94ea0 100644 --- a/client/browser/src/shared/code-hosts/bitbucket/scrape.ts +++ b/client/browser/src/shared/code-hosts/bitbucket/scrape.ts @@ -10,10 +10,16 @@ export interface BitbucketRepoInfo { project: string } +/** + * For testing only, used to set the window.location value. + * @internal + */ +export const windowLocation__testingOnly: { value: Pick | null } = { value: null } + const LINK_SELECTORS = ['a.raw-view-link', 'a.source-view-link', 'a.mode-source'] const bitbucketToSourcegraphRepoName = ({ repoSlug, project }: BitbucketRepoInfo): string => - [window.location.hostname, project, repoSlug].join('/') + [(windowLocation__testingOnly.value ?? window.location).hostname, project, repoSlug].join('/') /** * Attempts to parse the file info from a link element contained in the given @@ -278,7 +284,9 @@ export const getFileInfoWithoutCommitIDsFromMultiFileDiffCodeView = ( } // Get project and repo from the URL - const pathMatch = location.pathname.match(/\/projects\/(.*?)\/repos\/(.*?)\//) + const pathMatch = (windowLocation__testingOnly.value ?? window.location).pathname.match( + /\/projects\/(.*?)\/repos\/(.*?)\// + ) if (!pathMatch) { throw new Error('Location did not match regexp') } @@ -316,9 +324,13 @@ export const getFileInfoFromCommitDiffCodeView = (codeViewElement: HTMLElement): } export function getPRIDFromPathName(): number { - const prIDMatch = window.location.pathname.match(/pull-requests\/(\d*?)\/(diff|overview|commits)/) + const prIDMatch = (windowLocation__testingOnly.value ?? window.location).pathname.match( + /pull-requests\/(\d*?)\/(diff|overview|commits)/ + ) if (!prIDMatch) { - throw new Error(`Could not parse PR ID from pathname: ${window.location.pathname}`) + throw new Error( + `Could not parse PR ID from pathname: ${(windowLocation__testingOnly.value ?? window.location).pathname}` + ) } return parseInt(prIDMatch[1], 10) } diff --git a/client/browser/src/shared/code-hosts/github/codeHost.test.ts b/client/browser/src/shared/code-hosts/github/codeHost.test.ts index 63c57bdd130..0d6a8dbca77 100644 --- a/client/browser/src/shared/code-hosts/github/codeHost.test.ts +++ b/client/browser/src/shared/code-hosts/github/codeHost.test.ts @@ -18,6 +18,7 @@ import { isPrivateRepository, parseHash, } from './codeHost' +import { windowLocation__testingOnly } from './util' const testCodeHost = (fixturePath: string): void => { if (existsSync(fixturePath)) { @@ -83,11 +84,15 @@ describe('github/codeHost', () => { const urlToFile = githubCodeHost.urlToFile! const sourcegraphURL = 'https://sourcegraph.my.org' + afterAll(() => { + windowLocation__testingOnly.value = null + }) + describe('on blob page', () => { beforeAll(() => { - jsdom.reconfigure({ - url: 'https://github.com/sourcegraph/sourcegraph/blob/main/browser/src/shared/code-hosts/code_intelligence.tsx', - }) + windowLocation__testingOnly.value = new URL( + 'https://github.com/sourcegraph/sourcegraph/blob/main/browser/src/shared/code-hosts/code_intelligence.tsx' + ) }) it('returns an URL to the Sourcegraph instance if the location has a viewState', () => { expect( @@ -154,7 +159,9 @@ describe('github/codeHost', () => { }) describe('on pull request page', () => { beforeAll(async () => { - jsdom.reconfigure({ url: 'https://github.com/sourcegraph/sourcegraph/pull/3257/files' }) + windowLocation__testingOnly.value = new URL( + 'https://github.com/sourcegraph/sourcegraph/pull/3257/files' + ) document.documentElement.innerHTML = await readFile( __dirname + '/__fixtures__/github.com/pull-request/vanilla/unified/page.html', 'utf-8' @@ -213,15 +220,8 @@ describe('isPrivateRepository', () => { }) describe('when on "github.com"', () => { - const { location } = window - beforeAll(() => { - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - delete window.location - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - window.location = new URL('https://github.com') + windowLocation__testingOnly.value = new URL('https://github.com') }) beforeEach(() => { @@ -232,7 +232,7 @@ describe('isPrivateRepository', () => { afterAll(() => { fetch.disableMocks() - window.location = location + windowLocation__testingOnly.value = null }) it('returns [private=true] on unsuccessful request', async () => { diff --git a/client/browser/src/shared/code-hosts/github/codeHost.tsx b/client/browser/src/shared/code-hosts/github/codeHost.tsx index 9ee42beb5cf..cf3d3f39fe2 100644 --- a/client/browser/src/shared/code-hosts/github/codeHost.tsx +++ b/client/browser/src/shared/code-hosts/github/codeHost.tsx @@ -31,7 +31,14 @@ import type { ViewResolver } from '../shared/views' import { diffDomFunctions, searchCodeSnippetDOMFunctions, singleFileDOMFunctions } from './domFunctions' import { resolveDiffFileInfo, resolveFileInfo, resolveSnippetFileInfo } from './fileInfo' -import { getFileContainers, parseURL, getSelectorFor, isNewGitHubUI, getEmbeddedData } from './util' +import { + getFileContainers, + parseURL, + getSelectorFor, + isNewGitHubUI, + getEmbeddedData, + windowLocation__testingOnly, +} from './util' import styles from './codeHost.module.scss' @@ -286,7 +293,8 @@ export function checkIsGitHubEnterprise(): boolean { /** * Returns true if the current page is github.com. */ -export const checkIsGitHubDotCom = (url = window.location.href): boolean => /^https?:\/\/(www\.)?github\.com/.test(url) +export const checkIsGitHubDotCom = (url = (windowLocation__testingOnly.value ?? window.location).href): boolean => + /^https?:\/\/(www\.)?github\.com/.test(url) /** * Returns true if the current page is either github.com or GitHub Enterprise. @@ -383,7 +391,7 @@ export const isPrivateRepository = async ( fetchCache = background.fetchCache, fallbackSelector = '#repository-container-header span.Label' ): Promise => { - if (window.location.hostname !== 'github.com') { + if ((windowLocation__testingOnly.value ?? window.location).hostname !== 'github.com') { return Promise.resolve(true) } try { @@ -418,12 +426,15 @@ export interface GithubCodeHost extends CodeHost { export const isGithubCodeHost = (codeHost: CodeHost): codeHost is GithubCodeHost => codeHost.type === 'github' -const isSimpleSearchPage = (): boolean => window.location.pathname === '/search' -const isAdvancedSearchPage = (): boolean => window.location.pathname === '/search/advanced' -const isRepoSearchPage = (): boolean => !isSimpleSearchPage() && window.location.pathname.endsWith('/search') +const isSimpleSearchPage = (): boolean => (windowLocation__testingOnly.value ?? window.location).pathname === '/search' +const isAdvancedSearchPage = (): boolean => + (windowLocation__testingOnly.value ?? window.location).pathname === '/search/advanced' +const isRepoSearchPage = (): boolean => + !isSimpleSearchPage() && (windowLocation__testingOnly.value ?? window.location).pathname.endsWith('/search') const isSearchResultsPage = (): boolean => // TODO(#44327): Do not rely on window.location.search - it may be present not only on search pages (e.g., issues, pulls, etc.). - Boolean(new URLSearchParams(window.location.search).get('q')) && !isAdvancedSearchPage() + Boolean(new URLSearchParams((windowLocation__testingOnly.value ?? window.location).search).get('q')) && + !isAdvancedSearchPage() const isSearchPage = (): boolean => isSimpleSearchPage() || isAdvancedSearchPage() || isRepoSearchPage() || isSearchResultsPage() @@ -440,7 +451,9 @@ type GithubResultType = | 'users' const getGithubResultType = (): GithubResultType | '' => { - const githubResultType = new URLSearchParams(window.location.search).get('type') + const githubResultType = new URLSearchParams((windowLocation__testingOnly.value ?? window.location).search).get( + 'type' + ) return githubResultType ? (githubResultType.toLowerCase() as GithubResultType) : '' } @@ -466,7 +479,8 @@ const getSourcegraphResultType = (): SourcegraphResultType | '' => { } } -const getSourcegraphResultLanguage = (): string | null => new URLSearchParams(window.location.search).get('l') +const getSourcegraphResultLanguage = (): string | null => + new URLSearchParams((windowLocation__testingOnly.value ?? window.location).search).get('l') const buildSourcegraphQuery = (searchTerms: string[]): string => { const queryParameters = searchTerms.filter(Boolean).map(parameter => parameter.trim()) @@ -482,7 +496,7 @@ const buildSourcegraphQuery = (searchTerms: string[]): string => { } if (isRepoSearchPage()) { - const [user, repo] = window.location.pathname.split('/').filter(Boolean) + const [user, repo] = (windowLocation__testingOnly.value ?? window.location).pathname.split('/').filter(Boolean) queryParameters.push(`repo:${user}/${repo}$`) } @@ -673,7 +687,7 @@ export const githubCodeHost: GithubCodeHost = { routeChange: mutations => mutations.pipe( map(() => { - const { pathname } = window.location + const { pathname } = windowLocation__testingOnly.value ?? window.location // repository file tree navigation const pageType = pathname.slice(1).split('/')[2] @@ -738,7 +752,9 @@ export const githubCodeHost: GithubCodeHost = { } // Make sure the location is also on this github instance, return an absolute URL otherwise. - const sameCodeHost = target.rawRepoName.startsWith(window.location.hostname) + const sameCodeHost = target.rawRepoName.startsWith( + (windowLocation__testingOnly.value ?? window.location).hostname + ) if (!sameCodeHost) { return toAbsoluteBlobURL(sourcegraphURL, target) } @@ -763,7 +779,7 @@ export const githubCodeHost: GithubCodeHost = { const anchorPath = header.dataset.path if (anchorPath === target.filePath) { const anchorUrl = header.dataset.anchor - const url = new URL(window.location.href) + const url = new URL((windowLocation__testingOnly.value ?? window.location).href) url.hash = anchorUrl if (target.position) { // GitHub uses L for the left side, R for both right side and the unchanged/white parts @@ -787,7 +803,7 @@ export const githubCodeHost: GithubCodeHost = { }, observeLineSelection: fromEvent(window, 'hashchange').pipe( startWith(undefined), // capture initial value - map(() => parseHash(window.location.hash)) + map(() => parseHash((windowLocation__testingOnly.value ?? window.location).hash)) ), codeViewsRequireTokenization: true, } diff --git a/client/browser/src/shared/code-hosts/github/domFunctions.test.tsx b/client/browser/src/shared/code-hosts/github/domFunctions.test.tsx index a9c0e03b447..0ee15b73464 100644 --- a/client/browser/src/shared/code-hosts/github/domFunctions.test.tsx +++ b/client/browser/src/shared/code-hosts/github/domFunctions.test.tsx @@ -1,10 +1,11 @@ -import { beforeEach, describe, expect, it } from '@jest/globals' +import { afterEach, beforeEach, describe, expect, it } from '@jest/globals' import { startCase } from 'lodash' import type { Omit } from 'utility-types' import { type DOMFunctionsTest, getFixtureBody, testDOMFunctions } from '../shared/codeHostTestUtils' import { diffDomFunctions, isDomSplitDiff, singleFileDOMFunctions } from './domFunctions' +import { windowLocation__testingOnly } from './util' type GitHubVersion = 'github.com' | 'ghe-2.14.11' @@ -131,12 +132,14 @@ describe('GitHub DOM functions', () => { ] for (const { view, url } of views) { describe(`${startCase(view)} page`, () => { - beforeEach(() => { - // TODO ideally DOM functions would not look at global state like the URL. - jsdom.reconfigure({ url }) - }) for (const extension of ['vanilla', 'refined-github']) { describe(startCase(extension), () => { + beforeEach(() => { + windowLocation__testingOnly.value = new URL(url) + }) + afterEach(() => { + windowLocation__testingOnly.value = null + }) if (view === 'pull-request-discussion') { it('should return false', async () => { const codeViewElement = await getFixtureBody({ diff --git a/client/browser/src/shared/code-hosts/github/domFunctions.ts b/client/browser/src/shared/code-hosts/github/domFunctions.ts index e83b591da5b..a69c1a9ba6f 100644 --- a/client/browser/src/shared/code-hosts/github/domFunctions.ts +++ b/client/browser/src/shared/code-hosts/github/domFunctions.ts @@ -233,8 +233,7 @@ export const searchCodeSnippetDOMFunctions: DOMFunctions = { /** * Returns if the current view shows diffs with split (vs. unified) view. - * - * @param element, either an element contained in a code view or the code view itself + * @param element either an element contained in a code view or the code view itself */ export function isDomSplitDiff(element: HTMLElement): boolean { const { pageType } = parseURL() diff --git a/client/browser/src/shared/code-hosts/github/fileInfo.test.ts b/client/browser/src/shared/code-hosts/github/fileInfo.test.ts index c17049451f7..46350e6f4a9 100644 --- a/client/browser/src/shared/code-hosts/github/fileInfo.test.ts +++ b/client/browser/src/shared/code-hosts/github/fileInfo.test.ts @@ -41,8 +41,7 @@ describe('github/fileInfo', () => { for (const { url, rev, filePath } of toReturn) { it(`returns "${filePath}" for URL "${url}" and revision "${rev}"`, () => { - jsdom.reconfigure({ url }) - expect(getFilePathFromURL(rev)).toBe(filePath) + expect(getFilePathFromURL(rev, new URL(url))).toBe(filePath) }) } @@ -61,9 +60,8 @@ describe('github/fileInfo', () => { for (const { url, rev, reason } of toThrow) { it(`throws an error for URL "${url}" and revision "${rev}", reason: "${reason}"`, () => { - jsdom.reconfigure({ url }) expect(() => { - getFilePathFromURL(rev) + getFilePathFromURL(rev, new URL(url)) }).toThrow() }) } diff --git a/client/browser/src/shared/code-hosts/github/util.tsx b/client/browser/src/shared/code-hosts/github/util.tsx index 592a4c4e5b8..c3d764ebaa3 100644 --- a/client/browser/src/shared/code-hosts/github/util.tsx +++ b/client/browser/src/shared/code-hosts/github/util.tsx @@ -3,6 +3,12 @@ import type { RawRepoSpec, RepoSpec } from '@sourcegraph/shared/src/util/url' import type { DiffResolvedRevisionSpec } from '../../repo' import { RepoURLParseError } from '../shared/errors' +/** + * For testing only, used to set the window.location value. + * @internal + */ +export const windowLocation__testingOnly: { value: URL | null } = { value: null } + /** * Returns the elements on the page which should be marked * up with tooltips & links: @@ -237,10 +243,10 @@ export function getFilePath(): string { * making the boundary between the branch name and file path ambiguous. * E.g., in URL "https://github.com/sourcegraph/sourcegraph/blob/bext/release/package.json" branch name is "bext/release". */ -export function getFilePathFromURL(rev: string): string { +export function getFilePathFromURL(rev: string, windowLocation__testingOnly: URL | Location = window.location): string { // ///(blob|tree)// // eslint-disable-next-line unicorn/no-unreadable-array-destructuring - const [, , , pageType, ...revAndPathParts] = window.location.pathname.split('/') + const [, , , pageType, ...revAndPathParts] = windowLocation__testingOnly.pathname.split('/') const revAndPath = revAndPathParts.join('/') if (!revAndPath.startsWith(rev) || (pageType !== 'tree' && revAndPath.length === rev.length)) { throw new Error('Failed to extract the file path from the URL.') @@ -273,11 +279,11 @@ export function isDiffPageType(pageType: GitHubURL['pageType']): boolean { } } -export function parseURL(location: Pick = window.location): GitHubURL { - const { host, pathname } = location +export function parseURL(location?: Pick): GitHubURL { + const { pathname, href, host } = location ?? windowLocation__testingOnly.value ?? window.location const [user, ghRepoName, pageType, ...rest] = pathname.slice(1).split('/') if (!user || !ghRepoName) { - throw new RepoURLParseError(`Could not parse repoName from GitHub url: ${location.href}`) + throw new RepoURLParseError(`Could not parse repoName from GitHub url: ${href}`) } const repoName = `${user}/${ghRepoName}` const rawRepoName = `${host}/${repoName}` diff --git a/client/browser/src/shared/code-hosts/gitlab/__fixtures__/merge-request.html b/client/browser/src/shared/code-hosts/gitlab/__fixtures__/merge-request.html index cd5208f9a04..24eb38a6d09 100644 --- a/client/browser/src/shared/code-hosts/gitlab/__fixtures__/merge-request.html +++ b/client/browser/src/shared/code-hosts/gitlab/__fixtures__/merge-request.html @@ -1,42 +1,42 @@ - - + + - + - + Test Merge Request (!1) · Merge Requests · sourcegraph / jsonrpc2 · GitLab - - + + - - - - - - - - + + + + + + + - - - + + + @@ -125,33 +125,33 @@ @@ -181,7 +181,7 @@ window, document, 'script', - 'https://assets.gitlab-static.net/assets/snowplow/sp-e10fd598642f1a4dd3e9e0e026f6a1ffa3c31b8a40efd92db3f92d32873baed6.js', + 'https://example.com/assets/snowplow/sp-e10fd598642f1a4dd3e9e0e026f6a1ffa3c31b8a40efd92db3f92d32873baed6.js', 'snowplow' ) @@ -204,7 +204,7 @@ @@ -468,7 +468,7 @@ class="avatar s40 avatar-tile js-lazy-loaded qa-js-lazy-loaded" width="40" height="40" - src="https://assets.gitlab-static.net/uploads/-/system/project/avatar/250833/runner_logo.png?width=40" + src="https://example.com/uploads/-/system/project/avatar/250833/runner_logo.png?width=40" />

+
) diff --git a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductLicenseNode.test.tsx b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductLicenseNode.test.tsx index 10cc77c03f5..871ec56e463 100644 --- a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductLicenseNode.test.tsx +++ b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/SiteAdminProductLicenseNode.test.tsx @@ -6,7 +6,7 @@ import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing' import { SiteAdminProductLicenseNode } from './SiteAdminProductLicenseNode' import { mockLicenseContext } from './testUtils' -jest.mock('../../../dotcom/productSubscriptions/AccountName', () => ({ AccountName: 'AccountName' })) +jest.mock('../../../dotcom/productSubscriptions/AccountName', () => ({ AccountName: () => 'AccountName' })) describe('SiteAdminProductLicenseNode', () => { const origContext = window.context diff --git a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/__snapshots__/SiteAdminProductLicenseNode.test.tsx.snap b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/__snapshots__/SiteAdminProductLicenseNode.test.tsx.snap index 9da71f24b00..d93d1e86c71 100644 --- a/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/__snapshots__/SiteAdminProductLicenseNode.test.tsx.snap +++ b/client/web/src/enterprise/site-admin/dotcom/productSubscriptions/__snapshots__/SiteAdminProductLicenseNode.test.tsx.snap @@ -49,7 +49,7 @@ exports[`SiteAdminProductLicenseNode active 1`] = ` - + AccountName
- + AccountName
'KeyIcon') -jest.mock('mdi-react/InformationIcon', () => 'InformationIcon') -jest.mock('../../../components/CopyableText', () => ({ CopyableText: 'CopyableText' })) +jest.mock('mdi-react/KeyIcon', () => () => 'KeyIcon') +jest.mock('mdi-react/InformationIcon', () => () => 'InformationIcon') +jest.mock('../../../components/CopyableText', () => ({ CopyableText: () => 'CopyableText' })) describe('UserProductSubscriptionStatus', () => { test('toggle', () => { diff --git a/client/web/src/enterprise/user/productSubscriptions/__snapshots__/UserProductSubscriptionStatus.test.tsx.snap b/client/web/src/enterprise/user/productSubscriptions/__snapshots__/UserProductSubscriptionStatus.test.tsx.snap index b9187fc2a42..8cecb49d99b 100644 --- a/client/web/src/enterprise/user/productSubscriptions/__snapshots__/UserProductSubscriptionStatus.test.tsx.snap +++ b/client/web/src/enterprise/user/productSubscriptions/__snapshots__/UserProductSubscriptionStatus.test.tsx.snap @@ -155,10 +155,7 @@ exports[`UserProductSubscriptionStatus toggle: license key revealed 1`] = ` > License key

- + CopyableText diff --git a/client/web/src/marketing/toast/SurveyToast.test.tsx b/client/web/src/marketing/toast/SurveyToast.test.tsx index 4a73be0bdc4..63918f86b1f 100644 --- a/client/web/src/marketing/toast/SurveyToast.test.tsx +++ b/client/web/src/marketing/toast/SurveyToast.test.tsx @@ -33,9 +33,9 @@ describe('SurveyToast', () => { }) const mockClient = createMockClient( - { contents: JSON.stringify({}) }, + { temporarySettings: { contents: JSON.stringify({}) } }, gql` - query TemporarySettings { + query GetTemporarySettings { temporarySettings { contents } diff --git a/client/web/src/nav/GlobalNavbar.test.tsx b/client/web/src/nav/GlobalNavbar.test.tsx index 94d18b4c832..215b82308c0 100644 --- a/client/web/src/nav/GlobalNavbar.test.tsx +++ b/client/web/src/nav/GlobalNavbar.test.tsx @@ -12,8 +12,8 @@ import { renderWithBrandedContext } from '@sourcegraph/wildcard/src/testing' import { GlobalNavbar } from './GlobalNavbar' -jest.mock('../search/input/SearchNavbarItem', () => ({ SearchNavbarItem: 'SearchNavbarItem' })) -jest.mock('../components/branding/BrandLogo', () => ({ BrandLogo: 'BrandLogo' })) +jest.mock('../search/input/SearchNavbarItem', () => ({ SearchNavbarItem: () => 'SearchNavbarItem' })) +jest.mock('../components/branding/BrandLogo', () => ({ BrandLogo: () => 'BrandLogo' })) const PROPS: React.ComponentProps = { authenticatedUser: null, diff --git a/client/web/src/nav/__snapshots__/GlobalNavbar.test.tsx.snap b/client/web/src/nav/__snapshots__/GlobalNavbar.test.tsx.snap index 2d949c1887e..495b9ea8202 100644 --- a/client/web/src/nav/__snapshots__/GlobalNavbar.test.tsx.snap +++ b/client/web/src/nav/__snapshots__/GlobalNavbar.test.tsx.snap @@ -13,10 +13,7 @@ exports[`GlobalNavbar default 1`] = ` class="d-flex align-items-center" href="/search" > -