Skip to content

Commit

Permalink
Add breaking test for global resolve data for Issue TehShrike#48
Browse files Browse the repository at this point in the history
  • Loading branch information
saibotsivad committed Oct 23, 2015
1 parent ec0fc9d commit 58578d3
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions test/pre-load-resolve.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
var test = require('tape-catch')
var getTestState = require('./helpers/test-state-factory')

test('global pre-loaded data is available in activate function', function(t) {
var testState = getTestState(t)
var stateRouter = testState.stateRouter

// the global pre-loaded object
abstractStateRouterPreLoadedResolveDataMap = { // jshint ignore:line
pants: {
size: 'huge'
}
}

t.plan(1)

stateRouter.addState({
name: 'pants',
template: '',
resolve: function(data, parameters, cb) {
t.fail('resolve has pre-loaded data so should not run')
cb(false)
},
activate: function(context) {
t.equal(context.content.size, 'huge', 'activate should access pre-loaded data')
t.end()
}
})

stateRouter.go('pants')
})

0 comments on commit 58578d3

Please sign in to comment.