Skip to content

Commit

Permalink
Use const instead of let
Browse files Browse the repository at this point in the history
  • Loading branch information
mjackson authored and timdorr committed Dec 22, 2015
1 parent 548cdd0 commit 13d9557
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions modules/__tests__/Location-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,43 @@ import { POP } from '../Actions'

describe('a location', function () {
it('knows its pathname', function () {
let location = createLocation('/home?the=query#the-hash')
const location = createLocation('/home?the=query#the-hash')
expect(location.pathname).toEqual('/home')
})

it('knows its search string', function () {
let location = createLocation('/home?the=query#the-hash')
const location = createLocation('/home?the=query#the-hash')
expect(location.search).toEqual('?the=query')
})

it('knows its hash', function () {
let location = createLocation('/home?the=query#the-hash')
const location = createLocation('/home?the=query#the-hash')
expect(location.hash).toEqual('#the-hash')
})

it('compensates if the location is fully qualified', function () {
let location = createLocation('https://example.com/home')
const location = createLocation('https://example.com/home')
expect(location.pathname).toEqual('/home')
})

it('does not strip URL-like strings in the query', function () {
let location = createLocation('/home?redirect=https://example.com/')
const location = createLocation('/home?redirect=https://example.com/')
expect(location.pathname).toEqual('/home')
expect(location.search).toEqual('?redirect=https://example.com/')
})

it('has null state by default', function () {
let location = createLocation()
const location = createLocation()
expect(location.state).toBe(null)
})

it('uses pop navigation by default', function () {
let location = createLocation()
const location = createLocation()
expect(location.action).toBe(POP)
})

it('has a null key by default', function () {
let location = createLocation()
const location = createLocation()
expect(location.key).toBe(null)
})

Expand All @@ -52,15 +52,15 @@ describe('a location', function () {
})

it('has a key by default', function () {
let location = history.createLocation()
const location = history.createLocation()
expect(location.key).toExist()
})
})
})

describe('creating a location with an object', function () {
it('puts the pathname, search, and hash in the proper order', function () {
let location = createLocation({
const location = createLocation({
pathname: '/the/path',
search: '?the=query',
hash: '#the-hash'
Expand Down
10 changes: 5 additions & 5 deletions modules/__tests__/describeBasename.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function describeBasename(createHistory) {

describe('in push', function () {
it('works with string', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand All @@ -46,7 +46,7 @@ function describeBasename(createHistory) {
})

it('works with object', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -86,7 +86,7 @@ function describeBasename(createHistory) {

describe('in replace', function () {
it('works with string', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand All @@ -109,7 +109,7 @@ function describeBasename(createHistory) {
})

it('works with object', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -195,7 +195,7 @@ function describeBasename(createHistory) {

describe('in push', function () {
it('works', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down
4 changes: 2 additions & 2 deletions modules/__tests__/describeGo.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function describeGo(createHistory) {

describe('back', function () {
it('calls change listeners with the previous location', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -51,7 +51,7 @@ function describeGo(createHistory) {

describe('forward', function () {
it('calls change listeners with the next location', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down
8 changes: 4 additions & 4 deletions modules/__tests__/describePush.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function describePush(createHistory) {

describe('with a path string', function () {
it('calls change listeners with the new location', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand All @@ -39,7 +39,7 @@ function describePush(createHistory) {

describe('with a path object', function () {
it('calls change listeners with the new location', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand All @@ -66,7 +66,7 @@ function describePush(createHistory) {
it('correctly merges with old location', function (done) {
let oldLocation

let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -94,7 +94,7 @@ function describePush(createHistory) {
})

it('becomes a REPLACE if path is unchanged', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down
8 changes: 4 additions & 4 deletions modules/__tests__/describeQueries.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function describeQueries(createHistory) {

describe('in push', function () {
it('works', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -63,7 +63,7 @@ function describeQueries(createHistory) {

describe('in replace', function () {
it('works', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -167,7 +167,7 @@ function describeQueries(createHistory) {

describe('in push', function () {
it('works', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down Expand Up @@ -196,7 +196,7 @@ function describeQueries(createHistory) {

describe('in replace', function () {
it('works', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down
6 changes: 3 additions & 3 deletions modules/__tests__/describeReplace.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function describeReplace(createHistory) {

describe('with a path string', function () {
it('calls change listeners with the new location', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand All @@ -39,7 +39,7 @@ function describeReplace(createHistory) {

describe('with a path object', function () {
it('calls change listeners with the new location', function (done) {
let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand All @@ -66,7 +66,7 @@ function describeReplace(createHistory) {
it('correctly merges with old location', function (done) {
let oldLocation

let steps = [
const steps = [
function (location) {
expect(location.pathname).toEqual('/')
expect(location.search).toEqual('')
Expand Down
4 changes: 2 additions & 2 deletions modules/__tests__/describeTransitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function describeTransitions(createHistory) {
})

it('receives the next location', function (done) {
let steps = [
const steps = [
function () {
history.push({
pathname: '/home',
Expand Down Expand Up @@ -56,7 +56,7 @@ function describeTransitions(createHistory) {
})

it('receives the next location', function (done) {
let steps = [
const steps = [
function () {
history.push({
pathname: '/home',
Expand Down

0 comments on commit 13d9557

Please sign in to comment.