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 {TestScheduler} from 'rxjs'; | |
import {Arbitrary} from 'jsverify'; | |
import {equals} from 'ramda'; | |
import * as jsc from 'jsverify'; | |
// tslint:disable-next-line:no-require-imports | |
require('./jasmineHelpers2'); // https://github.com/jsverify/jsverify#usage-with-jasmine | |
type TestPropertyHandler = (propertyScheduler: TestScheduler, ...args: any[]) => void; | |
export function testObservableProperty(description: string, arbitrary1: Arbitrary<any>, handler: TestPropertyHandler): void; |
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 * as jsc from 'jsverify'; | |
const getRandomString = (length: number, chars: string) => { | |
let result = ''; | |
for (let i = length; i > 0; --i) { | |
result += chars[Math.floor(Math.random() * chars.length)]; | |
} | |
return result; | |
}; |
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
jest.mock('./process-env'); | |
import Mock = jest.Mock; | |
import {Observable} from 'rxjs'; | |
import {get} from './requests'; | |
import {getProcessEnv} from './process-env'; | |
describe('get', () => { | |
const originalAjaxGet = Observable.ajax.get; |
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
interface ReadonlyArray<T> { | |
/** | |
* Gets the length of the array. This is a number one higher than the highest element defined in an array. | |
*/ | |
readonly length: number; | |
/** | |
* Returns a string representation of an array. | |
*/ | |
toString(): string; | |
toLocaleString(): string; |
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
export const REQUESTING_LOGIN = 'REQUESTING_LOGIN'; | |
export const REQUESTING_ADMIN_TOKEN = 'REQUESTING_ADMIN_TOKEN'; | |
export const FETCHING_TABLES = 'FETCHING_TABLES'; | |
export const FETCHING_TABLE_SESSIONS_HISTORY = 'FETCHING_TABLE_SESSIONS_HISTORY'; | |
export const PENDING_TABLES = 'PENDING_TABLES'; | |
export const PENDING_TABLE_SESSIONS = 'PENDING_TABLE_SESSIONS'; |
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} from 'rxjs'; | |
import {Epic} from 'redux-observable'; | |
import {Store} from 'redux'; | |
import {pipe, clone, merge, keys, map, concat, uniq} from 'ramda'; | |
// tslint:disable-next-line:no-require-imports | |
const t = require('tcomb-validation'); | |
import {FETCHING_TABLE_SESSIONS_HISTORY} from '../constants/action-names'; | |
import { | |
get, isAjaxResponseDefined, |
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 Mock = jest.Mock; | |
import {expectEpic} from './expect-epic'; | |
import {getEpic} from './test-epic'; | |
describe('expectEpic', () => { | |
const actions = { | |
FETCH_FOO: 'FETCH_FOO', | |
FETCH_FOO_FULFILLED: 'FETCH_FOO_FULFILLED', |
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
equals( | |
pipe( | |
chain(f1), | |
chain(f2), | |
chain(f3) | |
)(whatever), | |
chain(pipeK(f1, f2, f3))(whatever) | |
) |
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
const accumMaker = (pred, reducer, memo = 0) => (...args) => { | |
const currentRes = reducer(...[memo, ...args]); | |
return pred(currentRes) ? currentRes : (...nextArgs) => accumMaker(pred, reducer, currentRes)(...nextArgs) | |
}; | |
// return itself until sum is lower than 10 | |
const accumulator = accumMaker((val) => val >= 10, function (memo, ...args) { | |
return [memo, ...args].reduce((previousValue, val) => previousValue + val, 0); | |
}); | |
accumulator(5)(1)(7); // 13 |
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
const obj1 = { | |
a: { b: { c: 1 } }, | |
x: 2 | |
}; | |
const dotPath = compose(path, split('.')); | |
const dotPaths = map(dotPath); | |
const propsDotPath = (paths, obj) => | |
ap(dotPaths(paths), [obj]) |
OlderNewer