Files
codeql-action/node_modules/@mswjs/interceptors/src/utils/getValueBySymbol.test.ts
2025-01-27 17:21:38 +00:00

15 lines
530 B
TypeScript

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')
})