This repository was archived by the owner on Sep 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathjscontext.ts
82 lines (78 loc) · 2.64 KB
/
jscontext.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { noOpTelemetryRecorder } from '@sourcegraph/shared/src/telemetry'
import { currentUserMock } from '@sourcegraph/shared/src/testing/integration/graphQlResults'
import type { SourcegraphContext } from '../jscontext'
export const siteID = 'TestSiteID'
export const siteGQLID = 'TestGQLSiteID'
export const builtinAuthProvider = {
serviceType: 'builtin' as const,
serviceID: '',
clientID: '',
displayName: 'Builtin username-password authentication',
isBuiltin: true,
authenticationURL: '',
noSignIn: false,
requiredForAuthz: false,
}
export const createJsContext = ({ sourcegraphBaseUrl }: { sourcegraphBaseUrl: string }): SourcegraphContext => ({
currentUser: currentUserMock,
temporarySettings: null,
externalURL: sourcegraphBaseUrl,
accessTokensAllow: 'all-users-create',
accessTokensAllowNoExpiration: false,
accessTokensExpirationDaysDefault: 60,
accessTokensExpirationDaysOptions: [7, 30, 60, 90],
allowSignup: false,
batchChangesEnabled: true,
applianceManaged: true,
batchChangesDisableWebhooksWarning: false,
batchChangesWebhookLogsEnabled: true,
codeInsightsEnabled: true,
executorsEnabled: true,
codyEnabledOnInstance: true,
codeSearchEnabledOnInstance: true,
codeIntelligenceEnabled: true,
codeMonitoringEnabled: true,
notebooksEnabled: true,
searchJobsEnabled: true,
searchAggregationEnabled: true,
searchContextsEnabled: true,
ownEnabled: true,
codyEnabledForCurrentUser: true,
codyRequiresVerifiedEmail: false,
extsvcConfigAllowEdits: false,
extsvcConfigFileExists: false,
codeIntelAutoIndexingEnabled: true,
codeIntelAutoIndexingAllowGlobalPolicies: true,
codeIntelRankingDocumentReferenceCountsEnabled: false,
productResearchPageEnabled: true,
assetsRoot: new URL('/.assets', sourcegraphBaseUrl).href,
deployType: 'dev',
debug: true,
emailEnabled: false,
experimentalFeatures: {},
isAuthenticatedUser: true,
licenseInfo: {
batchChanges: {
maxNumChangesets: -1,
unrestricted: true,
},
},
needServerRestart: false,
needsSiteInit: false,
needsRepositoryConfiguration: false,
resetPasswordEnabled: false,
sentryDSN: null,
site: {},
siteID,
siteGQLID,
sourcegraphDotComMode: false,
userAgentIsBot: false,
version: '0.0.0',
xhrHeaders: {},
authProviders: [builtinAuthProvider],
authMinPasswordLength: 12,
runningOnMacOS: true,
primaryLoginProvidersCount: 5,
// use noOpTelemetryRecorder since this jsContext is only used for integration tests.
telemetryRecorder: noOpTelemetryRecorder,
})