<commit_before>import test from 'ava'

import React, { Component } from 'react'
import { Observable } from '@reactivex/rxjs'
import { mount } from 'enzyme'

import connect from '../lib/connect'
import Provider from '../lib/Provider'
import createDispatcher from '../lib/createDispatcher'

function Child({data}) {
  return <div>{data}</div>
}

test('passes the observable down to connect', t => {
  const Tester = connect(observable => observable.map(x => `${x} world`))(Child)

  const wrapper = mount(
    <Provider observable={Observable.of('hello')}>
      <Tester/>
    </Provider>
  )

  const testerWrapper = wrapper.find(Tester).first()
  t.is(testerWrapper.text(), 'hello world')
})

test('connect passes dispatch, schedule and next', t => {
  t.plan(6)
  const dispatcher = createDispatcher()

  const Tester = connect(() => Observable.of('static'))(props => {
    t.is(typeof props.schedule, 'function')
    t.is(typeof props.dispatch, 'function')
    t.is(typeof props.next, 'function')

    t.is(props.schedule, dispatcher.schedule)
    t.is(props.dispatch, dispatcher.dispatch)
    t.is(props.next, dispatcher.next)

    return <div>{props.data}</div>
  })

  const wrapper = mount(
    <Provider observable={dispatcher}>
      <Tester/>
    </Provider>
  )
})
<commit_msg>Fix Provider test<commit_after>import test from 'ava'

import React, { Component } from 'react'
import { Observable } from '@reactivex/rxjs'
import { mount } from 'enzyme'

import connectStore from '../lib/connectStore'
import Provider from '../lib/Provider'

function Child({data}) {
  return <div>{data}</div>
}

test('passes the observable down to connect', t => {
  const Tester = connectStore(observable => observable.map(x => `${x} world`))(Child)

  const wrapper = mount(
    <Provider observable={Observable.of('hello')}>
      <Tester/>
    </Provider>
  )

  const testerWrapper = wrapper.find(Tester).first()
  t.is(testerWrapper.text(), 'hello world')
})

{'fraction_non_alphanumeric': 0.16010230179028134, 'fraction_numerical': 0.0005115089514066496, 'mean_word_length': 4.080519480519481, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6671390', 'n_tokens_mistral': 623, 'n_tokens_neox': 599, 'n_words': 155}