Spaces:
Paused
Paused
File size: 530 Bytes
9ada4bc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import { it, expect } from 'vitest'
import { getValueBySymbol } from './getValueBySymbol'
it('returns undefined given a non-existing symbol', () => {
expect(getValueBySymbol('non-existing', {})).toBeUndefined()
})
it('returns value behind the given symbol', () => {
const symbol = Symbol('kInternal')
expect(getValueBySymbol('kInternal', { [symbol]: null })).toBe(null)
expect(getValueBySymbol('kInternal', { [symbol]: true })).toBe(true)
expect(getValueBySymbol('kInternal', { [symbol]: 'value' })).toBe('value')
})
|