Skip to content

Instantly share code, notes, and snippets.

Working from home

Tracy Ngot TracyNgot

Working from home
Block or report user

Report or block TracyNgot

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
TracyNgot / unicorn.epic.test.ts
Last active Aug 8, 2019
Epic unit tests with TypeScript, Redux, RxJS 6 and Jest
View unicorn.epic.test.ts
// 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', () => {
TracyNgot / mock.ts
Created Nov 22, 2018
Mock Server With ExpressJS, Typescript and JSON
View mock.ts
interface Mock {
pathname: string;
method: string;
status: number;
responseBody: JSON;
class MockRoutes {
mockRoutes: Mock[] = [];
TracyNgot / mock-route.ts
Last active Nov 22, 2018
Mock Server With ExpressJS, TypeScript for your API
View mock-route.ts
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() {
TracyNgot / unicorn.action.ts
Created Sep 20, 2018
Action example with TypeScript
View unicorn.action.ts
export default class UnicornActions {
public static Types = {
public static error = (err: any, actionName: string) => ({
TracyNgot / unicorn.epic.ts
Last active Sep 21, 2018
Epic example with TypeScript, Redux, RxJS 6
View unicorn.epic.ts
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) =>
You can’t perform that action at this time.