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.app({
                    name: 'test_app'
                })
                .setup(function(api) {
                    fixtures().forEach(api.http.fixtures.add);
                });
        });

        describe("when the user starts a session", function() {
            it("should ask them want they want to do", function() {
                return tester
                    .start()
                    .check.interaction({
                        state: 'states:start',
                        reply: [
                            'Hi there! What do you want to do?',
                            '1. Show this menu again',
                            '2. Exit'
                        ].join('\n')
                    })
                    .run();
            });
        });

        describe("when the user asks to see the menu again", function() {
            it("should show the menu again", function() {
                return tester
                    .setup.user.state('states:start')
                    .input('1')
                    .check.interaction({
                        state: 'states:start',
                        reply: [
                            'Hi there! What do you want to do?',
                            '1. Show this menu again',
                            '2. Exit'
                        ].join('\n')
                    })
                    .run();
            });
        });

        describe("when the user asks to exit", function() {
            it("should say thank you and end the session", function() {
                return tester
                    .setup.user.state('states:start')
                    .input('2')
                    .check.interaction({
                        state: 'states:end',
                        reply: 'Thanks, cheers!'
                    })
                    .check.reply.ends_session()
                    .run();
            });
        });
    });
});

@@ -825,34 +825,36 @@
    state: 'state
-s:
+_lp_
 start',%0A        
@@ -975,36 +975,32 @@
     '1. 
-Show this menu again
+Go to next state
 ',%0A     
@@ -1193,26 +1193,28 @@
  to 
-see the menu again
+go to the next state
 %22, f
@@ -1252,27 +1252,24 @@
 uld 
-show the menu again
+go to next state
 %22, f
@@ -1346,34 +1346,36 @@
 ser.state('state
-s:
+_lp_
 start')%0A        
@@ -1476,22 +1476,23 @@
 : 'state
-s:star
+_lp_nex
 t',%0A    
@@ -1622,27 +1622,35 @@
 1. S
-how this menu again
+witch to TeacherPerformance
 ',%0A 
@@ -2009,18 +2009,20 @@
 e('state
-s:
+_lp_
 start')%0A
@@ -2135,13 +2135,16 @@
 tate
-s:end
+_lp_exit
 ',%0A 
@@ -2314,24 +2314,667 @@
         %7D);%0A
+%0A        describe(%22when the user asks to switch to tp%22, function() %7B%0A            it(%22should switch to state_tp_start%22, function() %7B%0A                return tester%0A                    .setup.user.state('state_lp_next')%0A                    .input('1')%0A                    .check.interaction(%7B%0A                        state: 'state_tp_start',%0A                        reply: %5B%0A                            'Hi there! What do you want to do?',%0A                            '1. Go to next state',%0A                            '2. Exit'%0A                        %5D.join('%5Cn')%0A                    %7D)%0A                    .run();%0A            %7D);%0A        %7D);%0A%0A
     %7D);%0A%7D);%0A

test compiling is working