Skip to content

Commit

Permalink
[DO NOT MERGE] add failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
taion committed Nov 19, 2015
1 parent 563b9eb commit 8da4252
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
24 changes: 24 additions & 0 deletions modules/__tests__/describeBasename.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ function describeBasename(createHistory) {
expect(location.state).toEqual({ the: 'state' })
expect(location.action).toEqual(PUSH)
expect(location.basename).toEqual('/base/url')

history.push({
...location,
pathname: '/foo'
})
},
function (location) {
expect(location.pathname).toEqual('/foo')
expect(location.search).toEqual('')
expect(location.state).toEqual({ the: 'state' })
expect(location.action).toEqual(PUSH)
expect(location.basename).toEqual('/base/url')
}
]

Expand Down Expand Up @@ -167,6 +179,18 @@ function describeBasename(createHistory) {
expect(location.state).toEqual({ the: 'state' })
expect(location.action).toEqual(REPLACE)
expect(location.basename).toEqual('/base/url')

history.replace({
...location,
pathname: '/foo'
})
},
function (location) {
expect(location.pathname).toEqual('/foo')
expect(location.search).toEqual('')
expect(location.state).toEqual({ the: 'state' })
expect(location.action).toEqual(REPLACE)
expect(location.basename).toEqual('/base/url')
}
]

Expand Down
26 changes: 26 additions & 0 deletions modules/__tests__/describeQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,19 @@ function describeQueries(createHistory) {
expect(location.query).toEqual({ the: 'query value' })
expect(location.state).toEqual({ the: 'state' })
expect(location.action).toEqual(PUSH)

history.push({
...location,
query: { other: 'query value' },
state: { other: 'state' }
})
},
function (location) {
expect(location.pathname).toEqual('/home')
expect(location.search).toEqual('?other=query+value')
expect(location.query).toEqual({ other: 'query value' })
expect(location.state).toEqual({ other: 'state' })
expect(location.action).toEqual(PUSH)
}
]

Expand Down Expand Up @@ -121,6 +134,19 @@ function describeQueries(createHistory) {
expect(location.query).toEqual({ the: 'query value' })
expect(location.state).toEqual({ the: 'state' })
expect(location.action).toEqual(REPLACE)

history.replace({
...location,
query: { other: 'query value' },
state: { other: 'state' }
})
},
function (location) {
expect(location.pathname).toEqual('/home')
expect(location.search).toEqual('?other=query+value')
expect(location.query).toEqual({ other: 'query value' })
expect(location.state).toEqual({ other: 'state' })
expect(location.action).toEqual(REPLACE)
}
]

Expand Down

0 comments on commit 8da4252

Please sign in to comment.