import test from "blue-tape" ; import { useStrict } from "../src/mobxShim" ; import { observable , runInAction } from "mobx" ; import { delay } from "./delay" ; export function testCombinations ( description , script ) { for ( const delayed of ( [ true , false ] ) ) { testStrictness ( `${ description }, delayed=${ delayed }` , assert => script ( delayed , assert ) ) ; } } export function testStrictness ( description , script ) { for ( const strict of [ true , false ] ) { test ( `${ description }, strict=${ strict }` , assert => { useStrict ( strict ) ; return script ( assert ) ; } ) ; } } export async function waitForLength ( ar , length ) { while ( ar . length !== length ) { await delay ( 5 ) ; } } export class Obs < T > { @ observable v : T ; constructor ( init ) { runInAction ( ( ) => this . v = init ) ; } get ( ) { return this . v ; } set ( val ) { this . v = val ; } }