import test from 'tape'
import { NAVIGATE, POP, REPLACE } from '../src/constants'
import { navigate, pop, replace } from '../src/actions'

test('navigate action', t => {
  t.plan(1)

  const action = navigate({
    pathname: '/foo',
    search: '?bar=baz',
    hash: '#quux'
  })

  t.deepEqual(action, {
    location: {
      hash: '#quux',
      pathname: '/foo',
      search: '?bar=baz',
    },
    type: NAVIGATE
  })
})

test('pop action', t => {
  t.plan(1)

  const action = pop({
    pathname: '/foo',
    search: '?bar=baz',
    hash: '#quux'
  })

  t.deepEqual(action, {
    location: {
      hash: '#quux',
      pathname: '/foo',
      search: '?bar=baz',
    },
    type: POP
  })
})

test('replace action', t => {
  t.plan(1)

  const action = replace({
    pathname: '/foo',
    search: '?bar=baz',
    hash: '#quux'
  })

  t.deepEqual(action, {
    location: {
      hash: '#quux',
      pathname: '/foo',
      search: '?bar=baz',
    },
    type: REPLACE
  })
})

@@ -179,384 +179,127 @@
 (1)%0A
-%0A
   
-const action = navigate(%7B%0A    pathname: '/foo',%0A    search: '?bar=baz',%0A    hash: '#quux'%0A  %7D)%0A%0A  t.deepEqual(action, %7B%0A    location: %7B%0A      hash: '#quux',%0A      pathname: '/foo',%0A      search: '?bar=baz',%0A    %7D,%0A    type: NAVIGATE%0A  %7D)%0A%7D)%0A%0Atest('pop action', t =%3E %7B%0A  t.plan(1)%0A%0A  const action = pop(%7B%0A    pathname: '/foo',%0A    search: '?bar=baz',%0A    hash: '#quux'%0A  %7D)%0A
+t.deepEqual(navigate('foo'), %7B%0A    location: 'foo',%0A    type: NAVIGATE%0A  %7D)%0A%7D)%0A%0Atest('pop action', t =%3E %7B%0A  t.plan(1)
 %0A  t
@@ -301,38 +301,42 @@
 )%0A  t.deepEqual(
-action
+pop('foo')
 , %7B%0A    location
@@ -341,86 +341,13 @@
 on: 
-%7B%0A      hash: '#quux',%0A      pathname: '/foo',%0A      search: '?bar=baz',%0A    %7D
+'foo'
 ,%0A  
@@ -413,222 +413,59 @@
 (1)%0A
-%0A
   
-const action = replace(%7B%0A    pathname: '/foo',%0A    search: '?bar=baz',%0A    hash: '#quux'%0A  %7D)%0A%0A  t.deepEqual(action, %7B%0A    location: %7B%0A      hash: '#quux',%0A      pathname: '/foo',%0A      search: '?bar=baz',%0A    %7D
+t.deepEqual(replace('foo'), %7B%0A    location: 'foo'
 ,%0A  

Simplify action tests