bahmutov / snap-shot

Jest-like snapshot feature for the rest of us, works magically by finding the right caller function
169 stars 3 forks source link

composed snapshot #19

Open bahmutov opened 7 years ago

bahmutov commented 7 years ago

Does not find the right source location if the snapshot was used in composition, for example src/format-spec.js

const compose = (f, g) => x => f(g(x))
const upperCase = x => x.toUpperCase()
const upValue = compose(snapshot, upperCase)
it('compares upper case string', () => {
  upValue('foo')
})

Should find upValue call

bahmutov commented 7 years ago

Need to make sure it can discover the desired function to handle multiple values

it('compares multiple upper case values', () => {
  upValue('foo')
  upValue('bar')
  upValue('baz')
})

Currently is looking for hardcoded string snapshot which does not work.