This file contains hidden or 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 { Expr } from 'faunadb'; | |
import QueryBuilder from './query-builder'; | |
describe('QueryBuilder', () => { | |
it('builds FaunaDB query', () => { | |
const testCollection = new QueryBuilder<any>('test'); | |
expect(testCollection.create({ test: 'my-test' })).toBeInstanceOf(Expr); | |
expect( | |
testCollection.update('id', { test: 'my-test-updated' }), | |
).toBeInstanceOf(Expr); |
This file contains hidden or 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
interface Mock { | |
pathname: string; | |
method: string; | |
status: number; | |
responseBody: JSON; | |
} | |
class MockRoutes { | |
mockRoutes: Mock[] = []; |
This file contains hidden or 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 * as express from 'express'; | |
import mockRoutes from './MockRoutes'; | |
import config from '../config/Config'; | |
import proxy = require('http-proxy-middleware'); | |
class Routes { | |
public router: express.Router = express.Router(); | |
constructor() { | |
this.config(); |
This file contains hidden or 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
export default class UnicornActions { | |
public static Types = { | |
ERROR: 'UNICORN_ERROR', | |
GET_UNICORN: 'GET_UNICORN', | |
LIKE_UNICORN: 'LIKE_UNICORN', | |
SUCCESS: 'UNICORN_SUCCESS', | |
UPDATE_UNICORN: 'UPDATE_UNICORN', | |
} | |
public static error = (err: any, actionName: string) => ({ |
This file contains hidden or 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 { ofType } from 'redux-observable'; | |
import { of } from 'rxjs'; | |
import { catchError, flatMap, map, mergeMap } from 'rxjs/operators'; | |
import UnicornActions from './unicorn.action'; | |
import UnicornApiService from './unicorn.api.service'; | |
export default class UnicornEpics { | |
public static getUnicorn = (actions$: any) => | |
actions$.pipe( | |
ofType(UnicornActions.Types.GET_UNICORN), |
This file contains hidden or 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
// src/tests/unicorn/unicorn.epic.test.ts | |
import { ActionsObservable } from 'redux-observable'; | |
import { of, throwError } from 'rxjs'; | |
import { toArray } from 'rxjs/operators'; | |
import UnicornActions from '../../store/unicorn/unicorn.action'; | |
import UnicornApiService from '../../store/unicorn/unicorn.api.service'; | |
import UnicornEpics from '../../store/unicorn/unicorn.epic'; | |
describe('Unicorn test', () => { |