Created
September 22, 2015 09:04
-
-
Save justinvdm/c68285d8caeed29f7499 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| go.app = function() { | |
| var vumigo = require('vumigo_v02'); | |
| var App = vumigo.App; | |
| var EndState = vumigo.states.EndState; | |
| var GoApp = App.extend(function(self) { | |
| App.call(self, 'states:start'); | |
| self.get_big_config = function() { | |
| // if you have a big config you only want to load for certain | |
| // states, you could do something like this | |
| return self.im.sandbox_config.get('big_config', {json: true}); | |
| }; | |
| self.states.add('states:start', function(name) { | |
| return self.get_big_config() | |
| .then(function(big_config) { | |
| return new EndState(name, { | |
| text: big_config.foo, | |
| next: 'states:start' | |
| }); | |
| }); | |
| }); | |
| }); | |
| return { | |
| GoApp: GoApp | |
| }; | |
| }(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var vumigo = require('vumigo_v02'); | |
| var fixtures = require('./fixtures'); | |
| var AppTester = vumigo.AppTester; | |
| describe("app", function() { | |
| describe("GoApp", function() { | |
| var app; | |
| var tester; | |
| beforeEach(function() { | |
| app = new go.app.GoApp(); | |
| tester = new AppTester(app); | |
| tester | |
| .setup.config({ | |
| big_config: { | |
| foo: 'bar' | |
| } | |
| }) | |
| .setup.config.app({ | |
| name: 'test_app' | |
| }) | |
| .setup(function(api) { | |
| fixtures().forEach(api.http.fixtures.add); | |
| }); | |
| }); | |
| describe("when the user starts a session", function() { | |
| it("should should them a foo bar", function() { | |
| return tester | |
| .start() | |
| .check.interaction({ | |
| state: 'states:start', | |
| reply: 'bar' | |
| }) | |
| .run(); | |
| }); | |
| }); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment