name: "Using JSONPath in expectations"
topic: "core/Repeat"
fixture:
 type: 'fbp'
 data: |
  # @runtime python-example

  INPORT=it.IN:IN
  OUTPORT=f.OUT:OUT

  it(core/Repeat) OUT -> IN f(core/Repeat)

cases:
-
  name: 'select single value'
  assertion: 'should pass'
  inputs:
    in: { outer: { inner: { foo: 'bar' } } }
  expect:
    out:
      path: '$.outer.inner.foo'
      equals: 'bar'
-
  name: 'selecting non-existent value'
  assertion: 'should fail'
  inputs:
    in: { outer: { inner: { foo: 'bar' } } }
  expect:
    out:
      path: '$.outer.nonexist'
      equals: 'bar'
-
  name: 'selecting many correct values'
  assertion: 'should pass'
  inputs:
    in:
      outer:
        first: { foo: 'bar' }
        second: { foo: 'bar' }
  expect:
    out:
      path: '$.outer.*.foo'
      equals: 'bar'
-
  name: 'selecting many values, some failing'
  assertion: 'should fail'
  inputs:
    in:
      outer:
        first: { foo: 'bar' }
        second: { foo: 'bar' }
        third: { foo: 'bazz' }
  expect:
    out:
      path: '$.outer.*.foo'
      equals: 'bar'
