diff --git a/packages/next/__tests__/moment.spec.ts b/packages/next/__tests__/moment.spec.ts index f5ba8ba64f5..e1e8c1388d0 100644 --- a/packages/next/__tests__/moment.spec.ts +++ b/packages/next/__tests__/moment.spec.ts @@ -8,6 +8,7 @@ test('momentable is usable', () => { moment.isMoment(item) ) ).toBe(true) + expect(momentable(0)).toBe(0) }) test('formatMomentValue is usable', () => { diff --git a/packages/reactive/src/__tests__/externals.spec.ts b/packages/reactive/src/__tests__/externals.spec.ts index 2dc35b40f10..8f33d3d37ff 100644 --- a/packages/reactive/src/__tests__/externals.spec.ts +++ b/packages/reactive/src/__tests__/externals.spec.ts @@ -74,6 +74,11 @@ describe('mark operation', () => { const obs = observable(markObservable(markRaw({ aa: 111 }))) expect(isObservable(obs)).toBe(false) }) + + test('function marked as observable should NOT be observable', () => { + const obs = observable(markObservable(() => {})) + expect(isObservable(obs)).toBe(false) + }) }) test('recursive references tojs', () => { @@ -82,4 +87,7 @@ test('recursive references tojs', () => { const obs = observable(obj) obs.obs = obs expect(toJS(obs)).toBeTruthy() + + const arrObs = observable([{ aa: 1 }, { bb: 2 }, { cc: 3 }]) + expect(toJS(arrObs)).toEqual([{ aa: 1 }, { bb: 2 }, { cc: 3 }]) }) diff --git a/packages/shared/src/__tests__/index.spec.ts b/packages/shared/src/__tests__/index.spec.ts index ab9660a8c97..03989fafd30 100644 --- a/packages/shared/src/__tests__/index.spec.ts +++ b/packages/shared/src/__tests__/index.spec.ts @@ -20,7 +20,16 @@ import { stringLength } from '../string' import { Subscribable } from '../subscribable' import { lazyMerge, merge } from '../merge' import { instOf } from '../instanceof' -import { isFn, isHTMLElement, isNumberLike, isReactElement } from '../checkers' +import { + isFn, + isHTMLElement, + isNumberLike, + isReactElement, + isMap, + isWeakMap, + isWeakSet, + isSet, +} from '../checkers' import { defaults } from '../defaults' import { applyMiddleware } from '../middleware' @@ -530,6 +539,20 @@ describe('types', () => { test('isHTMLElement', () => { expect(isHTMLElement(document.createElement('div'))).toBeTruthy() }) + test('isMap', () => { + expect(isMap(new Map())).toBeTruthy() + }) + test('isSet', () => { + expect(isSet(new Set())).toBeTruthy() + }) + test('isWeakMap', () => { + expect(isWeakMap(new WeakMap())).toBeTruthy() + expect(isWeakMap(new Map())).toBeFalsy() + }) + test('isWeakSet', () => { + expect(isWeakSet(new WeakSet())).toBeTruthy() + expect(isWeakSet(new Set())).toBeFalsy() + }) }) describe('merge', () => { diff --git a/packages/validator/src/__tests__/validator.spec.ts b/packages/validator/src/__tests__/validator.spec.ts index 27399d1b317..45ebf5340a8 100644 --- a/packages/validator/src/__tests__/validator.spec.ts +++ b/packages/validator/src/__tests__/validator.spec.ts @@ -203,6 +203,7 @@ test('max/maxItems/maxLength/minItems/minLength/min/maximum/exclusiveMaximum/min hasError(await validate({ aa: 1, bb: 2, cc: 3 }, { maxProperties: 2 })) noError(await validate({ aa: 1, cc: 3 }, { maxProperties: 2 })) hasError(await validate({ aa: 1 }, { minProperties: 2 })) + noError(await validate({ aa: 1, bb: 2, cc: 3 }, { minProperties: 2 })) noError(await validate({ aa: 1, cc: 3 }, { maxProperties: 2 })) })