mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-11 19:02:24 +03:00
fix: implement simply array polyfills (fixes #328)
This commit is contained in:
committed by
Alexander Lichter
parent
02c7beb6de
commit
d38f81e0a9
@@ -1,32 +1,7 @@
|
||||
/**
|
||||
* @jest-environment node
|
||||
*/
|
||||
import setOptions from '../../src/shared/options'
|
||||
import { setOptions } from '../../src/shared/options'
|
||||
import { defaultOptions } from '../../src/shared/constants'
|
||||
import { ensureIsArray } from '../../src/utils/ensure'
|
||||
import { hasGlobalWindowFn } from '../../src/utils/window'
|
||||
|
||||
describe('shared', () => {
|
||||
test('ensureIsArray ensures var is array', () => {
|
||||
let a = { p: 1 }
|
||||
expect(ensureIsArray(a)).toEqual([])
|
||||
|
||||
a = 1
|
||||
expect(ensureIsArray(a)).toEqual([])
|
||||
|
||||
a = [1]
|
||||
expect(ensureIsArray(a)).toBe(a)
|
||||
})
|
||||
|
||||
test('ensureIsArray ensures obj prop is array', () => {
|
||||
const a = { p: 1 }
|
||||
expect(ensureIsArray(a, 'p')).toEqual({ p: [] })
|
||||
})
|
||||
|
||||
test('no error when window is not defined', () => {
|
||||
expect(hasGlobalWindowFn()).toBe(false)
|
||||
})
|
||||
|
||||
test('can use setOptions', () => {
|
||||
const keyName = 'MY KEY'
|
||||
let options = { keyName }
|
||||
|
||||
Reference in New Issue
Block a user