type
stringclasses
7 values
content
stringlengths
4
9.55k
repo
stringlengths
7
96
path
stringlengths
4
178
language
stringclasses
1 value
TypeAliasDeclaration
export type CommonFormProps<T extends Record<string, any> = Record<string, any>> = { submitter?: | SubmitterProps<{ form?: FormInstance<any>; }> | false; /** * 支持异步操作,更加方便 * * @name 表单结束后调用 */ onFinish?: (formData: T) => Promise<boolean | void>; /** @name 获取真正的可以获得值的 from */...
Ives7/pro-components
packages/form/src/BaseForm/index.tsx
TypeScript
TypeAliasDeclaration
export type BaseFormProps<T = Record<string, any>> = { contentRender?: ( items: React.ReactNode[], submitter: React.ReactElement<SubmitterProps> | undefined, form: FormInstance<any>, ) => React.ReactNode; fieldProps?: FieldProps; onInit?: (values: T) => void; formItemProps?: FormItemProps; grou...
Ives7/pro-components
packages/form/src/BaseForm/index.tsx
TypeScript
FunctionDeclaration
export function setStatusBarColors() { // Make the iOS status bar transparent with white text. // See https://github.com/burkeholland/nativescript-statusbar/issues/2 // for details on the technique used. if (application.ios) { var AppDelegate = UIResponder.extend({ applicationDidFinishLaunchingWithOp...
larryaubstore/casse-tete-nativescript
app/utils/status-bar-util.ts
TypeScript
ClassDeclaration
/* * This program has been developed by students from the bachelor Computer Science at Utrecht University * within the Software Project course. © Copyright Utrecht University (Department of Information and * Computing Sciences) */ /** * @packageDocumentation * @module Models */ /** * This class represents the d...
okkibro/anti-bubble-app
src/app/models/item.ts
TypeScript
InterfaceDeclaration
/* * Copyright 2022 Palantir Technologies, Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless req...
KochiyaOcean/blueprint
packages/datetime2/src/common/timezoneItems.ts
TypeScript
ClassDeclaration
export class OA_YBHYSQYBHYSQ_W_MobWFMDViewBase extends IBizListViewController { mdctrl: mdctrlService; constructor(opt) { super(Object.assign(opt, { 'url': '/IonicApp/ywsp/OA_YBHYSQYBHYSQ_W_MobWFMDView.do' })); } ngOnInit(): void { this.mdctrl = new mdctrlService({ 'name': 'mdctrl', 'component': t...
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
ngOnInit(): void { this.mdctrl = new mdctrlService({ 'name': 'mdctrl', 'component': this, 'url': this.getBackendUrl() }); this.regControl('mdctrl', this.mdctrl); super.ngOnInit(); }
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
regUIActions(config){ let uiaction_0 = {"type":"DEUIACTION","tag":"New" }; super.regUIAction(uiaction_0); }
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
public getNewDataView(params: any = {}): any { let newmode = params.srfnewmode; if(!newmode) { newmode=''; } }
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
public getEditDataView(params: any = {}): any { let list = [params.srfeditmode2,params.srfeditmode]; for(let i=0;i<2;i++){ let editmode=list[i]; if(!editmode) continue; if(editmode=='10'){ return { openMode:'', className:'OA_YBHYSQYBHYSQ_W10_MobWFE...
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
getEditMode(data){ let editMode=super.getEditMode(data); if(editMode&&editMode!='') editMode= editMode+':'+ data.hysqbz; else editMode= data.hysqbz; return editMode; }
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
regAppFuncs(): void { super.regAppFuncs(); }
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
MethodDeclaration
regUICounters() : void { }
devibizsys/iBizSys_unip
app_IonicApp_pub/src/pages/ywsp/oa-ybhysqybhysq-w-mob-wfmdview/oa-ybhysqybhysq-w-mob-wfmdview.base.ts
TypeScript
InterfaceDeclaration
export default interface IFinancialItemIXC { id: string; status: string; charge: number; contract_r: string; installment_r: number; contract_a: string; sell_id: string; emission_date: Date; due_date: Date; value: number; received_value: number; open_value: number; paid_value: number; paymen...
GlarosConsulting/realdata
packages/robot/main/src/modules/ixc/customers/details/financial/models/IFinancialItemIXC.ts
TypeScript
EnumDeclaration
export enum SpecialKeys { ExtensionEnable = '<ExtensionEnable>', ExtensionDisable = '<ExtensionDisable>', TimeoutFinished = '<TimeoutFinished>', }
AMMAR-62/Vim
src/util/specialKeys.ts
TypeScript
ArrowFunction
(detail, components, spec, externals) => { return { 'uid': detail.uid, 'dom': detail.dom, 'components': components, 'debug.sketcher': 'Tabbar', domModification: { attributes: { role: 'tablist' } }, 'behaviours': SketchBehaviours.augment( detail.tabbarBehaviours...
AbdelzaherMuhammed/baramistan-new
public/admin/tinymce/modules/alloy/src/main/ts/ephox/alloy/api/ui/Tabbar.ts
TypeScript
ArrowFunction
(tab) => { return tab.element(); }
AbdelzaherMuhammed/baramistan-new
public/admin/tinymce/modules/alloy/src/main/ts/ephox/alloy/api/ui/Tabbar.ts
TypeScript
MethodDeclaration
// https://www.w3.org/TR/2010/WD-wai-aria-practices-20100916/#tabpanel // Consider a more seam-less way of combining highlighting and toggling onHighlight (tabbar, tab) { // TODO: Integrate highlighting and toggling in a nice way Attr.set(tab.element(), 'aria-selected', 'true'); }
AbdelzaherMuhammed/baramistan-new
public/admin/tinymce/modules/alloy/src/main/ts/ephox/alloy/api/ui/Tabbar.ts
TypeScript
MethodDeclaration
onDehighlight (tabbar, tab) { Attr.set(tab.element(), 'aria-selected', 'false'); }
AbdelzaherMuhammed/baramistan-new
public/admin/tinymce/modules/alloy/src/main/ts/ephox/alloy/api/ui/Tabbar.ts
TypeScript
MethodDeclaration
getInitial (tabbar) { // Restore focus to the previously highlighted tab. return Highlighting.getHighlighted(tabbar).map((tab) => { return tab.element(); }); }
AbdelzaherMuhammed/baramistan-new
public/admin/tinymce/modules/alloy/src/main/ts/ephox/alloy/api/ui/Tabbar.ts
TypeScript
ArrowFunction
(rawData : string) => { //Remove any double-quotes that would make the data ill-formed let transformed = rawData.replace(/"/g, ''); //Reformat combined column names for timestamps transformed = transformed.replace('Year Month Day Hour Minutes in YYYY,MM,DD,HH24,MI format in Local standard time'...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(row : any) => { return row.map((field : string) => { return field.trim(); }); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(field : string) => { return field.trim(); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(resolve : Function, reject : Function) => { readFile(csvFile).then((data : Buffer) => { //Apply the transformation function (if supplied) let transformed = data.toString('utf-8'); if (transform !== undefined) { transformed = transform(transformed); } //Attempt to parse the trans...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(data : Buffer) => { //Apply the transformation function (if supplied) let transformed = data.toString('utf-8'); if (transform !== undefined) { transformed = transform(transformed); } //Attempt to parse the transformed data let parser = csv_parse(transformed, undefined, (err : Err...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(err : Error, result : string[][]) => { if (err) { reject(err); } else { resolve(result); } }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(err : Error) => { reject(err); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(resolve : Function, reject : Function) => { csv_stringify(data, (err : Error, output : any) => { if (err) { Error.captureStackTrace(err); reject(err); } else { writeFile(csvFile, output).then((result : any) => { resolve(true); }) .catch((err : Error) => { ...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(err : Error, output : any) => { if (err) { Error.captureStackTrace(err); reject(err); } else { writeFile(csvFile, output).then((result : any) => { resolve(true); }) .catch((err : Error) => { reject(err); }); } }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(result : any) => { resolve(true); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(err : Error) => { reject(err); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(row : any[]) => { return row.map((field : any) => { return (($.type(field) == 'number' && Number.isInteger(field) === false) ? (<number>field).toFixed(2) : field.toString()); }); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(field : any) => { return (($.type(field) == 'number' && Number.isInteger(field) === false) ? (<number>field).toFixed(2) : field.toString()); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(field : string) => { return field.length; }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(row : string[]) => { return row.map((field : string, col : number) => { return pad(field, columnWidths[col]); }); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(field : string, col : number) => { return pad(field, columnWidths[col]); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(line : string) => { return line.length; }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(line : string, index : number) => { //Determine if this is a data row if (line.length == rowLength) { return true; } //If we are keeping the header, determine if this is the header row if (keepHeader === true && index < lines.length-1 && lines[index+1].length == rowLength) { //If the l...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Parses a headerless, single-column CSV file and returns the values as a list public static async csvToList(csvFile : string) { try { //Attempt to parse the CSV file let result = await CsvDataUtil.parseCsv(csvFile); //Flatten the result array let flattened : string[] = []; for (let row of resul...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Parses data in the hybrid fixed-width CSV format that BOM supplies data in public static async parseBOMCsv(csvFile : string) : Promise<string[][]> { try { //We need to transform the raw data before we can safely parse it let transform = (rawData : string) => { //Remove any double-quotes that would m...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Parses a CSV file, applying the data transformation callback (if supplied) prior to parsing public static parseCsv(csvFile : string, transform? : (rawData : string) => string) : Promise<string[][]> { return new Promise((resolve : Function, reject : Function) => { readFile(csvFile).then((data : Buffer) => ...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Writes data to a CSV file public static writeCsv(csvFile : string, data : any[][]) : Promise<boolean> { return new Promise((resolve : Function, reject : Function) => { csv_stringify(data, (err : Error, output : any) => { if (err) { Error.captureStackTrace(err); reject(err); } else...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Writes data to a CSV file in the hybrid fixed-width CSV format that BOM supplies data in public static async writeBOMCsv(csvFile : string, data : any[][]) { try { //Stringify the data, formatting floating-point values with two decimal places let headerRow = data.slice(0, 1); let stringified : string[][]...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Concatenates multiple station list CSV files, using the specified notes file to construct the common header public static async concatenateStationLists(listFiles : string[], notesFile : string) { try { //Read the notes data and discard all text prior to the section describing the site details file format l...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Determines the length of a row of data in a BOM-format CSV file private static dataRowLength(lines : string[]) : number { return mathjs.mode(lines.map((line : string) => { return line.length; })); }
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
MethodDeclaration
//Strips extraneous lines of text (e.g. notes) before or after the actual data in BOM-format CSV file private static stripExtraneousLines(csvData : string, keepHeader : boolean) { let lines = csvData.split('\n'); let rowLength = CsvDataUtil.dataRowLength(lines); return lines.filter((line : string, index : number...
adamrehn/ClimateQuery
source/ts/core/CsvDataUtil.ts
TypeScript
ArrowFunction
(v,k)=> { keys.push(k) }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
ArrowFunction
w => { if(this.tracks.has(w)) { let target= this.tracks.get(w); // ** target ** let f= this.source.getFeatureById('track-' + w); if(f) { // exists so update it f.setGeometry( new MultiLineString( this.parseCoordinates(target) ) ); f.setStyle(this.buildStyle(w...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
ArrowFunction
w=> { let f= this.source.getFeatureById('track-' + w); if(f) { this.source.removeFeature(f) } }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
ArrowFunction
mls=> { let lines:Array<any>= []; mls.forEach( line=> lines.push( mapifyCoords(line) ) ) return lines; }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
ArrowFunction
line=> lines.push( mapifyCoords(line) )
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
ClassDeclaration
// ** Signal K target tracks ** @Component({ selector: 'ol-map > sk-target-tracks', template: '<ng-content></ng-content>', changeDetection: ChangeDetectionStrategy.OnPush }) export class SKTargetTracksLayerComponent implements OnInit, OnDestroy, OnChanges { protected layer: Layer; public source: VectorSourc...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
ngOnInit() { this.source = new VectorSource(); this.layer = new VectorLayer(Object.assign(this, {...this.layerProperties})); this.parseItems( this.extractKeys(this.tracks) ); const map = this.mapComponent.getMap(); if(this.layer && map) { map.addLayer(this.layer); map.render(); t...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
ngOnChanges(changes: SimpleChanges) { if(this.layer) { const properties: { [index: string]: any } = {}; for(const key in changes) { if(key=='tracks' && changes[key].firstChange) { if(!changes[key].currentValue) { return } if(!this.source) { return } this.source.cle...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
ngOnDestroy() { const map = this.mapComponent.getMap(); if (this.layer && map) { map.removeLayer(this.layer); map.render(); this.layer = null; } }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
// ** assess attribute change ** handleLabelZoomChange(key: string, change: SimpleChange) { if(key=='labelMinZoom') { if(typeof this.mapZoom!=='undefined') { this.parseItems( this.extractKeys(this.tracks) ); } } else if(key=='mapZoom') { if(typeof this.minZoom !=='undefined') { ...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
extractKeys(m:Map<string,any>): Array<string> { let keys= []; m.forEach((v,k)=> { keys.push(k) }); return keys; }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
// add update features parseItems(ids: Array<string>) { if(!ids || !Array.isArray(ids) ) { return } if(!this.source) { return } ids.forEach( w => { if(this.tracks.has(w)) { let target= this.tracks.get(w); // ** target ** let f= this.source.getFeatureById('track-' + w); ...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
// remove features removeItems(ids:Array<string>) { if(!ids || !Array.isArray(ids) ) { return } if(!this.source) { return } ids.forEach( w=> { let f= this.source.getFeatureById('track-' + w); if(f) { this.source.removeFeature(f) } }); }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
// build target style buildStyle(id:string):Style { let rgb= (id.indexOf('aircraft')!=-1) ? '0, 0, 255' : '255, 0, 255'; let color= (this.mapZoom < this.minZoom) ? `rgba(${rgb},0)` : `rgba(${rgb},1)`; color= (this.showTracks) ? `rgba(${rgb},1)` : `rgba(${rgb},0)`; if(this.layerProperties && this.layerP...
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
MethodDeclaration
// ** mapify and transform MultiLineString coordinates parseCoordinates(trk:Array<any>) { // ** handle dateline crossing ** let tc= trk.map( mls=> { let lines:Array<any>= []; mls.forEach( line=> lines.push( mapifyCoords(line) ) ) return lines; }); return fromLonLatArray(tc); }
SignalK/freeboard-sk
projects/fb-openlayers/src/lib/resources/layer-sktarget-tracks.component.ts
TypeScript
ArrowFunction
() => { describe('SettingsComponent', () => { let comp: SettingsComponent; let fixture: ComponentFixture<SettingsComponent>; let mockAuth: any; let mockPrincipal: any; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [GatewayS...
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
ArrowFunction
() => { let comp: SettingsComponent; let fixture: ComponentFixture<SettingsComponent>; let mockAuth: any; let mockPrincipal: any; beforeEach(async(() => { TestBed.configureTestingModule({ imports: [GatewayServiceTestModule], declarat...
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
ArrowFunction
() => { TestBed.configureTestingModule({ imports: [GatewayServiceTestModule], declarations: [SettingsComponent], providers: [ ] }) .overrideTemplate(SettingsComponent, '') .compileComponents(); }
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
ArrowFunction
() => { fixture = TestBed.createComponent(SettingsComponent); comp = fixture.componentInstance; mockAuth = fixture.debugElement.injector.get(AccountService); mockPrincipal = fixture.debugElement.injector.get(Principal); }
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
ArrowFunction
() => { // GIVEN const accountValues = { firstName: 'John', lastName: 'Doe', activated: true, email: 'john.doe@mail.com', langKey: 'en', login: 'john' }; mockPrincipal.setRes...
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
ArrowFunction
() => { // GIVEN const accountValues = { firstName: 'John', lastName: 'Doe' }; mockPrincipal.setResponse(accountValues); // WHEN comp.save(); // THEN expect(comp.error).toBeNull(); ...
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
ArrowFunction
() => { // GIVEN mockAuth.saveSpy.and.returnValue(Observable.throw('ERROR')); // WHEN comp.save(); // THEN expect(comp.error).toEqual('ERROR'); expect(comp.success).toBeNull(); }
jeffersonxavier/jhipster-microservices
gateway-service/src/test/javascript/spec/app/account/settings/settings.component.spec.ts
TypeScript
FunctionDeclaration
function checkCacheAndNetworkError(callback: () => any) { try { callback(); throw new Error('not reached'); } catch (thrown) { expect(thrown.message).toBe(cacheAndNetworkError); } }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
FunctionDeclaration
function makeLink(reject: (reason: any) => any) { return mockSingleLink({ request: { query }, result: { data: firstFetch }, }, { request: { query }, result: { data: secondFetch }, }).setOnError(reject); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
FunctionDeclaration
function watch( query: DocumentNode, fetchPolicy: WatchQueryFetchPolicy = "cache-first", ): any[] { const results: any[] = []; const obsQuery = client.watchQuery({ query, fetchPolicy, }); obsQueries.add(obsQuery); subs.add(obsQuery.subscribe({ next(...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
FunctionDeclaration
function checkLastResult( results: any[], expectedData: Record<string, any>, ) { const lastResult = results[results.length - 1]; expect(lastResult).toEqual(expectedData); return lastResult; }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
FunctionDeclaration
function wait(time = 10) { return new Promise(resolve => setTimeout(resolve, time)); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
FunctionDeclaration
function clientRoundtrip( resolve: (result: any) => any, reject: (reason: any) => any, query: DocumentNode, data: ExecutionResult, variables?: any, possibleTypes?: PossibleTypesMap, ) { const link = mockSingleLink({ request: { query: cloneDeep(query) }, result: data, }).setOnError(reject); c...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
() => { /* tslint:disable */ const ApolloClientRequire = require('../').ApolloClient; /* tslint:enable */ const client = new ApolloClientRequire({ link: ApolloLink.empty(), cache: new InMemoryCache(), }); expect(client.queryManager).toBeDefined(); expect(client.cache).toBeDefi...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
() => { const link = ApolloLink.empty(); const client = new ApolloClient({ link, cache: new InMemoryCache(), }); expect(client.link).toBeInstanceOf(ApolloLink); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
() => { const client = new ApolloClient({ link: ApolloLink.empty(), cache: new InMemoryCache(), }); expect(() => { client.query(gql` { a } ` as any); }).toThrowError( 'query option is required. You must specify your GraphQL document in the query ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
() => { client.query(gql` { a } ` as any); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
() => { client.query({ query: '{ a }' } as any); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
async () => { const client = new ApolloClient({ link: ApolloLink.empty(), cache: new InMemoryCache(), }); return await expect( client.mutate({ query: gql` { a } `, } as any), ).rejects.toThrow( 'mutation option is required. ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name __typename } __typename } } `; const data = { allPeople: { people: [ { name: 'Luke Skywalker', ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name __typename } __typename } } `; const data = { allPeople: { people: [ { name: 'Luke Skywalker', ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
() => Observable.of({ data })
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
actualResult => { expect(actualResult.data).toEqual(data); resolve(); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query stuff( $test: Input = { key1: ["value", "value2"], key2: { key3: 4 } } ) { allStuff(test: $test) { people { name } } } `; const result = { allStuff: { people: [ ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
actualResult => { expect(actualResult.data).toEqual(result); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people($first: Int = 1) { allPeople(first: $first) { people { name } } } `; const variables = { first: 1 }; const override = { first: 2 }; const result = { allPeople: { people...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
actualResult => { return expect(actualResult.data).toEqual(result); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
actualResult => { return expect(actualResult.data).toEqual( overriddenResult, ); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query { ...QueryFragment } fragment QueryFragment on Query { records { id name __typename } __typename } `; const data = { records: [ { id: 1, name: 'One', __typen...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query { ...QueryFragment } fragment QueryFragment on Query { records { id name __typename } __typename } `; const data = { records: [ { id: 1, name: 'One', __typen...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { // The fragment should be used after the selected fields for the query. // Otherwise, the results aren't merged. // see: https://github.com/apollographql/apollo-client/issues/1479 const query = gql` query { records { id __typename } ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name } } } `; const data = { allPeople: { people: [ { name: 'Luke Skywalker', }, ], }, }; ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
result => { expect(result.data).toEqual(data); expect(finalState.data).toEqual( (client.cache as InMemoryCache).extract(), ); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name } } } `; const data = { allPeople: { people: [ { name: 'Luke Skywalker', }, ], }, }; ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
result => { expect(result.data).toEqual(data); expect(finalState.data).toEqual(client.extract()); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name } } } `; const data = { allPeople: { people: [ { name: 'Luke Skywalker', }, ], }, }; ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name } } } `; const errors: GraphQLError[] = [ new GraphQLError('Syntax Error GraphQL request (8:9) Expected Name, found EOF') ]; const link = ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(error: ApolloError) => { expect(error.graphQLErrors).toEqual(errors); }
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript
ArrowFunction
(resolve, reject) => { const query = gql` query people { allPeople(first: 1) { people { name } } } `; const data = { allPeople: { people: [ { name: 'Luke Skywalker', }, ], }, }; ...
AaronSuAu/apollo-client
src/__tests__/client.ts
TypeScript