type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
FunctionDeclaration
/** * generate script file name * @param fileNamePrefix */ export function getScriptName(fileNamePrefix: string): string { if (process.platform === 'win32') { return String.Format('{0}.ps1', fileNamePrefix); } else { return String.Format('{0}.sh', fileNamePrefix); } }
418sec/nni
ts/nni_manager/training_service/common/util.ts
TypeScript
FunctionDeclaration
export function getGpuMetricsCollectorBashScriptContent(scriptFolder: string): string { return `echo $$ > ${scriptFolder}/pid ; METRIC_OUTPUT_DIR=${scriptFolder} python3 -m nni.tools.gpu_tool.gpu_metrics_collector`; }
418sec/nni
ts/nni_manager/training_service/common/util.ts
TypeScript
FunctionDeclaration
export function runGpuMetricsCollector(scriptFolder: string): void { if (process.platform === 'win32') { const scriptPath = path.join(scriptFolder, 'gpu_metrics_collector.ps1'); const content = String.Format(GPU_INFO_COLLECTOR_FORMAT_WINDOWS, scriptFolder, path.join(scriptFolder, 'pid')); f...
418sec/nni
ts/nni_manager/training_service/common/util.ts
TypeScript
ArrowFunction
(i) => ig.add(fs.readFileSync(i).toString())
418sec/nni
ts/nni_manager/training_service/common/util.ts
TypeScript
ArrowFunction
fpart => { if (fpart !== '' && !validateFileName(fpart)) fileNameValid = false; }
418sec/nni
ts/nni_manager/training_service/common/util.ts
TypeScript
ArrowFunction
() => { runScript(scriptPath); }
418sec/nni
ts/nni_manager/training_service/common/util.ts
TypeScript
ArrowFunction
() => { describe('PasswordStrengthBarComponent', () => { let comp: PasswordStrengthBarComponent; let fixture: ComponentFixture<PasswordStrengthBarComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [PasswordStrengthBarComponent] }) .overrideTem...
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { let comp: PasswordStrengthBarComponent; let fixture: ComponentFixture<PasswordStrengthBarComponent>; beforeEach(async(() => { TestBed.configureTestingModule({ declarations: [PasswordStrengthBarComponent] }) .overrideTemplate(PasswordStrengthBarComponent, '') .co...
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ declarations: [PasswordStrengthBarComponent] }) .overrideTemplate(PasswordStrengthBarComponent, '') .compileComponents(); }
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(PasswordStrengthBarComponent); comp = fixture.componentInstance; }
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { it('should initialize with default values', () => { expect(comp.measureStrength('')).toBe(0); expect(comp.colors).toEqual(['#F00', '#F90', '#FF0', '#9F0', '#0F0']); expect(comp.getColor(0).idx).toBe(1); expect(comp.getColor(0).col).toBe(comp.colors[0]); }); it...
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { expect(comp.measureStrength('')).toBe(0); expect(comp.colors).toEqual(['#F00', '#F90', '#FF0', '#9F0', '#0F0']); expect(comp.getColor(0).idx).toBe(1); expect(comp.getColor(0).col).toBe(comp.colors[0]); }
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { expect(comp.measureStrength('')).toBe(0); expect(comp.measureStrength('aa')).toBeGreaterThanOrEqual(comp.measureStrength('')); expect(comp.measureStrength('aa^6')).toBeGreaterThanOrEqual(comp.measureStrength('aa')); expect(comp.measureStrength('Aa090(**)')).toBeGreaterThanOrEqua...
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ArrowFunction
() => { expect(comp.getColor(0).col).toBe(comp.colors[0]); expect(comp.getColor(11).col).toBe(comp.colors[1]); expect(comp.getColor(22).col).toBe(comp.colors[2]); expect(comp.getColor(33).col).toBe(comp.colors[3]); expect(comp.getColor(44).col).toBe(comp.colors[4]); }
0xqq/alchemy
alchemy-web/src/test/javascript/spec/app/account/password/password-strength-bar.component.spec.ts
TypeScript
ClassDeclaration
export default class Transaction implements TransactionData { from: string; to: string; amount: number; constructor(from: string, to: string, amount: number); }
manten120/blockchain-tutorial
types/transaction.d.ts
TypeScript
FunctionDeclaration
export default function clone<T>(obj: T): T | undefined { if (obj === undefined) { return; } return JSON.parse(JSON.stringify(obj), dateReviver); }
jbjorge/diffx
core/src/clone.ts
TypeScript
ArrowFunction
() => { test('should compute ordinal data domain: sort & remove nulls', () => { const data = [{ x: 'd' }, { x: 'a' }, { x: null }, { x: 'b' }]; const accessor: AccessorFn = (datum: any) => datum.x; const isSorted = true; const removeNull = true; const ordinalDataDomain = computeOrdinalDataDomain...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ x: 'd' }, { x: 'a' }, { x: null }, { x: 'b' }]; const accessor: AccessorFn = (datum: any) => datum.x; const isSorted = true; const removeNull = true; const ordinalDataDomain = computeOrdinalDataDomain( data, accessor, isSorted, removeNull, ); ...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
(datum: any) => datum.x
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ x: 'd' }, { x: 'a' }, { x: null }, { x: 'b' }]; const accessor: AccessorFn = (datum: any) => datum.x; const isSorted = false; const removeNull = true; const ordinalDataDomain = computeOrdinalDataDomain( data, accessor, isSorted, removeNull, ); ...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ x: 'd' }, { x: 'a' }, { x: null }, { x: 'b' }]; const accessor: AccessorFn = (datum: any) => datum.x; const isSorted = true; const removeNull = false; const ordinalDataDomain = computeOrdinalDataDomain( data, accessor, isSorted, removeNull, ); ...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ x: 'd' }, { x: 'a' }, { x: null }, { x: 'b' }]; const accessor: AccessorFn = (datum: any) => datum.x; const isSorted = false; const removeNull = false; const ordinalDataDomain = computeOrdinalDataDomain( data, accessor, isSorted, removeNull, ); ...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ x: 12 }, { x: 6 }, { x: 8 }]; const accessor: AccessorFn = (datum: any) => datum.x; const scaleToExtent = true; const continuousDataDomain = computeContinuousDataDomain( data, accessor, scaleToExtent, ); const expectedContinuousDomain = [6, 12]; ...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ x: 12 }, { x: 6 }, { x: 8 }]; const accessor: AccessorFn = (datum: any) => datum.x; const continuousDataDomain = computeContinuousDataDomain( data, accessor, ); const expectedContinuousDomain = [0, 12]; expect(continuousDataDomain).toEqual(expectedContinuo...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data: any[] = []; const accessor: AccessorFn = (datum: any) => datum.x; const continuousDataDomain = computeContinuousDataDomain( data, accessor, ); const expectedContinuousDomain = [0, 0]; expect(continuousDataDomain).toEqual(expectedContinuousDomain); }
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ y: 12, x: 'a' }, { y: 6, x: 'b' }, { y: 8, x: 'a' }]; const yAccessor: AccessorFn = (datum: any) => datum.y; const xAccessor: AccessorFn = (datum: any) => datum.x; const scaleToExtent = true; const stackedDataDomain = computeStackedContinuousDomain( data, xAcces...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
(datum: any) => datum.y
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { const data = [{ y: 12, x: 'a' }, { y: 6, x: 'b' }, { y: 8, x: 'a' }]; const yAccessor: AccessorFn = (datum: any) => datum.y; const xAccessor: AccessorFn = (datum: any) => datum.x; const stackedDataDomain = computeStackedContinuousDomain( data, xAccessor, yAccessor, ); ...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { // start & end are positive expect(computeDomainExtent([5, 10], true)).toEqual([5, 10]); expect(computeDomainExtent([5, 10], false)).toEqual([0, 10]); // start & end are negative expect(computeDomainExtent([-15, -10], true)).toEqual([-15, -10]); expect(computeDomainExtent([-15, -10], f...
cchaos/elastic-charts
src/lib/utils/domain.test.ts
TypeScript
ArrowFunction
() => { let service: MetadataService; beforeEach(() => { TestBed.configureTestingModule({}); service = TestBed.inject(MetadataService); }); it('should be created', () => { expect(service).toBeTruthy(); }); }
MonicaisHer/edgex-ui-go
web/src/app/services/metadata.service.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({}); service = TestBed.inject(MetadataService); }
MonicaisHer/edgex-ui-go
web/src/app/services/metadata.service.spec.ts
TypeScript
ArrowFunction
(path, time = Math.random() * 1000) => new Promise(resolve => { setTimeout(() => { resolve(path); }, time); })
realeve/savefood2020
src/utils/axios.ts
TypeScript
ArrowFunction
resolve => { setTimeout(() => { resolve(path); }, time); }
realeve/savefood2020
src/utils/axios.ts
TypeScript
ArrowFunction
() => { resolve(path); }
realeve/savefood2020
src/utils/axios.ts
TypeScript
ArrowFunction
data => R.type(data).toLowerCase()
realeve/savefood2020
src/utils/axios.ts
TypeScript
ArrowFunction
(option: AxiosOption) => { option = Object.assign(option, { method: option.method || 'get', }); return http .create({ baseURL: host, timeout: 30 * 1000, transformRequest: [ function(data) { let dataType = getType(data); switch (dataType) { case '...
realeve/savefood2020
src/utils/axios.ts
TypeScript
ArrowFunction
({ data }) => data
realeve/savefood2020
src/utils/axios.ts
TypeScript
InterfaceDeclaration
// 自动处理token更新,data 序列化等 export interface AxiosOption { [key: string]: any; }
realeve/savefood2020
src/utils/axios.ts
TypeScript
TypeAliasDeclaration
// 导出数据,随机时长 export type MockFn = <T>(path: T, time?: number) => Promise<T>;
realeve/savefood2020
src/utils/axios.ts
TypeScript
ArrowFunction
() => { describe('Album Service', () => { let injector: TestBed; let service: AlbumService; let httpMock: HttpTestingController; let elemDefault: IAlbum; let expectedResult; let currentDate: moment.Moment; beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpCli...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { let injector: TestBed; let service: AlbumService; let httpMock: HttpTestingController; let elemDefault: IAlbum; let expectedResult; let currentDate: moment.Moment; beforeEach(() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule] }); ex...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule] }); expectedResult = {}; injector = getTestBed(); service = injector.get(AlbumService); httpMock = injector.get(HttpTestingController); currentDate = moment(); elemDefault = new Album(0,...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { it('should find an element', () => { const returnedFromService = Object.assign( { created: currentDate.format(DATE_TIME_FORMAT) }, elemDefault ); service .find(123) .pipe(take(1)) .subscribe(resp => (expectedR...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { const returnedFromService = Object.assign( { created: currentDate.format(DATE_TIME_FORMAT) }, elemDefault ); service .find(123) .pipe(take(1)) .subscribe(resp => (expectedResult = resp)); const req = httpMo...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
resp => (expectedResult = resp)
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { const returnedFromService = Object.assign( { id: 0, created: currentDate.format(DATE_TIME_FORMAT) }, elemDefault ); const expected = Object.assign( { created: currentDate }, returnedFromServi...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { const returnedFromService = Object.assign( { title: 'BBBBBB', description: 'BBBBBB', created: currentDate.format(DATE_TIME_FORMAT) }, elemDefault ); const expected = Object.assign( { created: curren...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { const returnedFromService = Object.assign( { title: 'BBBBBB', description: 'BBBBBB', created: currentDate.format(DATE_TIME_FORMAT) }, elemDefault ); const expected = Object.assign( { created: current...
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
resp => resp.body
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
body => (expectedResult = body)
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { service.delete(123).subscribe(resp => (expectedResult = resp.ok)); const req = httpMock.expectOne({ method: 'DELETE' }); req.flush({ status: 200 }); expect(expectedResult); }
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
resp => (expectedResult = resp.ok)
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
() => { httpMock.verify(); }
oktadeveloper/okta-ionic4-jhipster-example
app/src/test/javascript/spec/app/entities/album/album.service.spec.ts
TypeScript
ArrowFunction
(m, c) => { let testId: string; try { testId = m.json.testId; } catch (e) { /* Ignored. Covered in another test case that `event.data.json` works. */ } return new TestSuite<PubsubMessage>('pubsub onPublish') .it('should have a topic as resource', (message, context) => expectEq( context.res...
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => expectEq( context.resource.name, `projects/${process.env.GCLOUD_PROJECT}/topics/pubsubTests`)
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => expectEq((context as any).path, undefined)
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => expectEq( context.eventType, 'google.pubsub.topic.publish')
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => context.eventId
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => context.timestamp
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => expectEq((context as any).auth, undefined)
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message, context) => expectEq((context as any).action, undefined)
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message) => { const decoded = (new Buffer(message.data, 'base64')).toString(); const parsed = JSON.parse(decoded); return evaluate(parsed.hasOwnProperty('testId'), 'Raw data was: ' + message.data); }
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
(message) => evaluate(message.json.hasOwnProperty('testId'), message.json)
yoshitsugu/firebase-functions
integration_test/functions/src/pubsub-tests.ts
TypeScript
ArrowFunction
() => { const form = useForm({ mode: 'all', }) return ( <Form autoComplete="off" form={form} onSubmit={values
Liinkiing/klee
src/components/form/Form.stories.tsx
TypeScript
ArrowFunction
() => { const form = useZodForm({ schema, mode: 'all', }) return ( <Form autoComplete="off" form={form} onSubmit={values
Liinkiing/klee
src/components/form/Form.stories.tsx
TypeScript
ArrowFunction
(address: string) => this.lookupName(address)
DavidBurela/burner-wallet-2
packages/ens-plugin/src/ENSPlugin.ts
TypeScript
ArrowFunction
(search: string) => search.length > 3 && search.indexOf('.') !== -1 ? this.ensSearch(search) : Promise.resolve([])
DavidBurela/burner-wallet-2
packages/ens-plugin/src/ENSPlugin.ts
TypeScript
ClassDeclaration
export default class ENSPlugin implements Plugin { private ensCache: { [name: string]: string | null }; private reverseCache: { [address: string]: string | null }; private ens: ENS | null; private network: string; constructor(network = '1') { this.ensCache = {}; this.reverseCache = {}; this.ens ...
DavidBurela/burner-wallet-2
packages/ens-plugin/src/ENSPlugin.ts
TypeScript
MethodDeclaration
initializePlugin(pluginContext: BurnerPluginContext) { this.ens = new ENS(pluginContext.getWeb3(this.network), this.network); pluginContext.addAddressToNameResolver((address: string) => this.lookupName(address)); pluginContext.onAccountSearch((search: string) => search.length > 3 && search.indexOf('...
DavidBurela/burner-wallet-2
packages/ens-plugin/src/ENSPlugin.ts
TypeScript
MethodDeclaration
async lookupName(address: string) { if (this.reverseCache[address] !== undefined) { return this.reverseCache[address]; } try { const name = await this.ens!.reverseLookup(address); this.reverseCache[address] = name; return name; } catch (e) { console.warn('Reverse ENS erro...
DavidBurela/burner-wallet-2
packages/ens-plugin/src/ENSPlugin.ts
TypeScript
MethodDeclaration
async ensSearch(search: string) { const cached = this.ensCache[search] if (cached !== undefined) { return cached ? [{ name: search, address: cached }] : []; } const address = await this.ens!.getAddress(search); this.ensCache[search] = address; return address ? [{ name: search, address }]...
DavidBurela/burner-wallet-2
packages/ens-plugin/src/ENSPlugin.ts
TypeScript
ArrowFunction
() => { // this is just a little hack to silence a warning that we'll get until react // fixes this: https://github.com/facebook/react/pull/14853 // For us that mean we need to upgrade to 16.9.0 // and we will be able to do that when we are in master // eslint-disable-next-line no-console const originalErr...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
() => { // eslint-disable-next-line no-console console.error = (...args: string[]) => { if (/Warning.*not wrapped in act/.test(args[0])) { return; } originalError.call(console, ...args); }; }
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
(...args: string[]) => { if (/Warning.*not wrapped in act/.test(args[0])) { return; } originalError.call(console, ...args); }
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
() => { // eslint-disable-next-line no-console console.error = originalError; }
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const { container } = render( <TestProviders> <MockedProvider mocks={mockFirstLastSeenDomainQuery} addTypename={false}> <FirstLastSeenDomain ip={ip} domainName={domainName} flowTarget={FlowTarget.source} type="first-seen" ...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const { container } = render( <TestProviders> <MockedProvider mocks={mockFirstLastSeenDomainQuery} addTypename={false}> <FirstLastSeenDomain ip={ip} domainName={domainName} flowTarget={FlowTarget.source} type="first-seen" ...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const { container } = render( <TestProviders> <MockedProvider mocks={mockFirstLastSeenDomainQuery} addTypename={false}> <FirstLastSeenDomain ip={ip} domainName={domainName} flowTarget={FlowTarget.source} type="last-seen" ...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const badDateTime = cloneDeep(mockFirstLastSeenDomainQuery); badDateTime[0].result.data!.source.DomainFirstLastSeen.firstSeen = null; const { container } = render( <TestProviders> <MockedProvider mocks={badDateTime} addTypename={false}> <FirstLastSeenDomain ...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const badDateTime = cloneDeep(mockFirstLastSeenDomainQuery); badDateTime[0].result.data!.source.DomainFirstLastSeen.lastSeen = null; const { container } = render( <TestProviders> <MockedProvider mocks={badDateTime} addTypename={false}> <FirstLastSeenDomain ...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const badDateTime = cloneDeep(mockFirstLastSeenDomainQuery); badDateTime[0].result.data!.source.DomainFirstLastSeen.firstSeen = 'something-invalid'; const { container } = render( <TestProviders> <MockedProvider mocks={badDateTime} addTypename={false}> <FirstLastSeenDom...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
async () => { const badDateTime = cloneDeep(mockFirstLastSeenDomainQuery); badDateTime[0].result.data!.source.DomainFirstLastSeen.lastSeen = 'something-invalid'; const { container } = render( <TestProviders> <MockedProvider mocks={badDateTime} addTypename={false}> <FirstLastSeenDoma...
varadhodiyil/kibana-auth
x-pack/plugins/siem/public/components/page/network/first_last_seen_domain/index.test.tsx
TypeScript
ArrowFunction
({ matchInfo, selectedTeam, setSelectedTeam, setMode }: Props) => { const { _id, homeTeam, awayTeam } = matchInfo; const [selectedPlayer, setSelectedPlayer] = useState(''); const [hasPlayerResults, setHasPlayerResults] = useState(false); const { register, handleSubmit, setValue } = useForm<PlayerResultsType>({...
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
ArrowFunction
(formData: FormDataType & { playerId: string; matchId: string; teamId: string; opponentTeamId: string }) => fetch(`${API_DOMAIN}/playerResults`, { method: 'POST', body: JSON.stringify(formData), headers: { 'Content-Type': 'application/json', }, })
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
ArrowFunction
() => { setMode('view'); }
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
ArrowFunction
(data: Record<string, string>) => { if (!selectedPlayer) return alert('請選取球員'); mutate({ playerId: selectedPlayer, teamId: selectedTeam, points: parseInt(data.points, 10), assists: parseInt(data.assists, 10), blocks: parseInt(data.blocks, 10), dRebounds: parseInt(data.dRebo...
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
InterfaceDeclaration
interface Props { matchInfo: MatchInfoType; selectedTeam: string; setSelectedTeam: React.Dispatch<React.SetStateAction<string>>; setMode: React.Dispatch<React.SetStateAction<'view' | 'edit'>>; }
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
TypeAliasDeclaration
type FormDataType = { assists: number; blocks: number; dRebounds: number; fouls: number; ftAttempts: number; ftMades: number; minutes: number; oRebounds: number; points: number; positions: number; steals: number; threeAttempts: number; threeMades: number; turnovers: number; twoAttempts: n...
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
MethodDeclaration
hasPlayerResults ? <MatchInfo matchInfo={matchInfo}
ss77995ss/baksetball-scorebook
src/Matches/Match/Edit/index.tsx
TypeScript
FunctionDeclaration
function authNoOp( req: Express.Request, res: Express.Response, next: (err?: Error) => void) { req.user = { sub : NEXT_USERID, }; next(); }
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
FunctionDeclaration
function readFileToBuffer(path: string) { return new Promise((resolve, reject) => { fs.readFile(path, (err, data) => { if (err) { return reject(err); } return resolve(data); }); }...
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
async () => { authStub = sinon.stub(auth, 'authenticate').callsFake(authNoOp); checkUserStub = sinon.stub(auth, 'checkValidUser').callsFake(authNoOp); requireSupervisorStub = sinon.stub(auth, 'requireSupervisor').callsFake(authNoOp); oldEnvCreds = process.env.OBJECT_STORE_CREDS; ...
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
async () => { process.env.OBJECT_STORE_CREDS = oldEnvCreds; process.env.OBJECT_STORE_BUCKET = oldEnvBucket; authStub.restore(); checkUserStub.restore(); requireSupervisorStub.restore(); await store.deleteProjectsByClassId(TESTCLASS); return store.disconnect();...
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
() => { mock.reset(); cosStub = sinon.stub(IBMCosSDK, 'S3'); cosStub.returns(mock.mockS3); imagestore.init(); NEXT_USERID = 'studentid'; }
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
() => { cosStub.restore(); }
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
() => { let projectid = ''; before(() => { return store.storeProject('studentid', TESTCLASS, 'images', 'invalids', 'en', [], false) .then((proj) => { projectid = proj.id; return store.addLabelToProject('studentid', TESTCLASS, project...
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
() => { return store.storeProject('studentid', TESTCLASS, 'images', 'invalids', 'en', [], false) .then((proj) => { projectid = proj.id; return store.addLabelToProject('studentid', TESTCLASS, projectid, 'KNOWN'); }); }
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
(proj) => { projectid = proj.id; return store.addLabelToProject('studentid', TESTCLASS, projectid, 'KNOWN'); }
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
() => { return request(testServer) .post('/api/classes/' + TESTCLASS + '/students/studentid/projects/NOTAREALPROJECT/images') .expect(httpStatus.NOT_FOUND) .then((res) => { assert.deepStrictEqual(res.body, { error : 'Not found' }); ...
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript
ArrowFunction
(res) => { assert.deepStrictEqual(res.body, { error : 'Not found' }); }
DGraveling/taxinomitis
src/tests/restapi/imageuploads.ts
TypeScript