This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DateErrorStateMatcher implements ErrorStateMatcher { | |
private hasError: boolean = undefined; | |
constructor(hasError$: Observable<boolean>, destroy$: Observable<void>) { | |
hasError$.pipe(takeUntil(destroy$)).subscribe(hasError => { | |
this.hasError = hasError; | |
}); | |
} | |
public isErrorState( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { fakeAsync, tick } from '@angular/core/testing'; | |
import { of, throwError } from 'rxjs'; | |
import { mergeMap } from 'rxjs/operators'; | |
import { | |
exponentialBackoffRetry, | |
RETRY_COUNT, | |
RETRY_TIME, | |
} from './exponential-backoff-retry'; | |
describe('exponentialBackoffRetry', () => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Observable, pipe, range, throwError, zip, of, timer } from 'rxjs'; | |
import { map, mergeMap, retryWhen } from 'rxjs/operators'; | |
export const RETRY_COUNT = 3; | |
export const RETRY_TIME = 500; | |
export function exponentialBackoffRetry<T>( | |
maxTries: number = RETRY_COUNT, | |
delay: number = RETRY_TIME, | |
) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloCache } from '@apollo/client/core'; | |
import { DocumentNode } from 'graphql'; | |
export interface EntityObject { | |
id: string; | |
} | |
export function createInCache<ReadQueryResponseT>( | |
toCreate: EntityObject, | |
readQuery: DocumentNode, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('TodoListEffects', () => { | |
let actions: Observable<any>; | |
let effects: TodoListEffects; | |
beforeEach(() => { | |
TestBed.configureTestingModule({ | |
providers: [ | |
TodoListEffects, | |
provideMockActions(() => actions), | |
mockProvider(TodoListResourcesService), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function containsInNestedObjectBF(obj, val) { | |
const queue = [obj]; | |
while (queue.length > 0) { | |
const currentObj = queue.shift(); | |
if (currentObj === val) { | |
return true; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloServer, AuthenticationError } from 'apollo-server-express'; | |
import responseCachePlugin from 'apollo-server-plugin-response-cache'; | |
import * as express from 'express'; | |
import admin from 'firebase-admin'; | |
import { AuthIdentity, RequestContext } from './auth-identity'; | |
import { resolvers } from './resolvers'; | |
import { typeDefs } from './schema'; | |
/* Async verification with user token */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ApolloServer, AuthenticationError } from 'apollo-server-express'; | |
import responseCachePlugin from 'apollo-server-plugin-response-cache'; | |
import * as express from 'express'; | |
import admin from 'firebase-admin'; | |
import { AuthIdentity, RequestContext } from './auth-identity'; | |
import { resolvers } from './resolvers'; | |
import { typeDefs } from './schema'; | |
/* Async verification with user token */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { region } from 'firebase-functions'; | |
import { gqlServer } from './app/server'; | |
import { environment } from './environments/environment'; | |
const dotenvJSON = require('dotenv-json'); | |
if (environment.production) { | |
dotenvJSON({ path: __dirname + '/assets/env.json' }); | |
} else { | |
dotenvJSON({ path: __dirname + '/assets/env.local.json' }); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Protractor configuration file, see link for more information | |
// https://github.com/angular/protractor/blob/master/lib/config.ts | |
const { SpecReporter } = require('jasmine-spec-reporter'); | |
exports.config = { | |
allScriptsTimeout: 11000, | |
specs: [ | |
'./src/**/*.e2e-spec.ts' | |
], |
NewerOlder