Sha256: 5a6ecca5783da5f717f09d7ed0893eabab18f70ebfa4f280dffafe619dc6a47b

Contents?: true

Size: 793 Bytes

Versions: 26

Compression:

Stored size: 793 Bytes

Contents

import { it, expect } from 'vitest'
import { findPropertySource } from './findPropertySource'

it('returns the source for objects without prototypes', () => {
  const obj = Object.create(null)
  obj.test = undefined
  const source = findPropertySource(obj, 'test')
  expect(source).toBe(obj)
})

it('returns the source for objects with prototypes', () => {
  const prototype = Object.create(null)
  prototype.test = undefined

  const obj = Object.create(prototype)

  const source = findPropertySource(obj, 'test')
  expect(source).toBe(prototype)
})

it('returns null if the prototype chain does not contain the property', () => {
  const prototype = Object.create(null)
  const obj = Object.create(prototype)

  const source = findPropertySource(obj, 'test')
  expect(source).toBeNull()
})

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.6 lib/clapton/javascripts/node_modules/@mswjs/interceptors/src/utils/findPropertySource.test.ts
clapton-0.0.5 lib/clapton/javascripts/node_modules/@mswjs/interceptors/src/utils/findPropertySource.test.ts
clapton-0.0.4 lib/clapton/javascripts/node_modules/@mswjs/interceptors/src/utils/findPropertySource.test.ts
clapton-0.0.3 lib/clapton/javascripts/node_modules/@mswjs/interceptors/src/utils/findPropertySource.test.ts
clapton-0.0.2 lib/clapton/javascripts/node_modules/@mswjs/interceptors/src/utils/findPropertySource.test.ts
clapton-0.0.1 lib/clapton/javascripts/node_modules/@mswjs/interceptors/src/utils/findPropertySource.test.ts