source.map is not a function
nickmeldrum opened this issue · comments
Was trying your jest example line for line from the readme:
import { marbles } from 'rxjs-marbles'
test('does something', marbles(m => {
const values = { a: 1, b: 2, c: 3, d: 4 }
const source = m.hot('--^-a-b-c-|', values)
const subs = '^-------!'
const expected = m.cold('--b-c-d-|', values)
const destination = source.map(value => value + 1)
m.expect(destination).toBeObservable(expected)
m.expect(source).toHaveSubscriptions(subs)
}))
and I receive the error:
TypeError: source.map is not a function
8 | const expected = m.cold('--b-c-d-|', values)
9 |
> 10 | const destination = source.map(value => value + 1)
11 | m.expect(destination).toBeObservable(expected)
12 | m.expect(source).toHaveSubscriptions(subs)
13 | }))
at scan.test.js:10:28
at Object.<anonymous> (node_modules/rxjs-marbles/bundles/rxjs-marbles.umd.js:2242:14)
looks to me like we expect the hot()
function to return an observable but instead it's returning a SubscriptionLoggable
type? I'm pretty new to rxjs so don't really understand!
any idea?
(My dependency versions:)
"jest": "^22.0.4",
"rxjs": "^5.5.6",
"rxjs-marbles": "^2.3.0"
I am such an idiot - i was just missing the step 1 of using rxjs version 5!
added import 'rxjs/add/operator/map'
to top of file and it all worked - sorry!