@@ -6,7 +6,7 @@ const expect = require('chai').use(require('chai-string')).expect;
66const { startServer, stopServer } = require ( '../../test-libs/index' ) ;
77
88describe . only ( 'simple acceptance' , function ( ) {
9- this . timeout ( 5000 ) ;
9+ this . timeout ( 20000 ) ;
1010
1111 before ( function ( ) {
1212 return startServer ( {
@@ -31,4 +31,99 @@ describe.only('simple acceptance', function() {
3131 expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
3232 expect ( response . body ) . to . contain ( "Basic fastboot ember app" ) ;
3333 } ) ;
34+
35+ it ( 'with fastboot query parameter turned on' , async ( ) => {
36+ const response = await request ( {
37+ url : 'http://localhost:49741/?fastboot=true' ,
38+ headers : {
39+ 'Accept' : 'text/html'
40+ }
41+ } )
42+
43+ expect ( response . statusCode ) . to . equal ( 200 ) ;
44+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
45+ expect ( response . body ) . to . contain ( "Basic fastboot ember app" ) ;
46+ } ) ;
47+
48+ it ( 'with fastboot query parameter turned off' , async ( ) => {
49+ const response = await request ( {
50+ url : 'http://localhost:49741/?fastboot=false' ,
51+ headers : {
52+ 'Accept' : 'text/html'
53+ }
54+ } )
55+
56+ expect ( response . statusCode ) . to . equal ( 200 ) ;
57+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
58+ expect ( response . body ) . to . contain ( "<!-- EMBER_CLI_FASTBOOT_BODY -->" ) ;
59+ } ) ;
60+
61+ it ( '/posts HTML contents' , async ( ) => {
62+ const response = await request ( {
63+ url : 'http://localhost:49741/posts' ,
64+ headers : {
65+ 'Accept' : 'text/html'
66+ }
67+ } )
68+
69+ expect ( response . statusCode ) . to . equal ( 200 ) ;
70+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
71+ expect ( response . body ) . to . contain ( "Welcome to Ember.js" ) ;
72+ expect ( response . body ) . to . contain ( "Posts Route!" ) ;
73+ } ) ;
74+
75+ it ( '/not-found HTML contents' , async ( ) => {
76+ const response = await request ( {
77+ url : 'http://localhost:49741/not-found' ,
78+ headers : {
79+ 'Accept' : 'text/html'
80+ }
81+ } )
82+
83+ expect ( response . statusCode ) . to . equal ( 200 ) ;
84+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
85+ expect ( response . body ) . to . contain ( "<!-- EMBER_CLI_FASTBOOT_BODY -->" ) ;
86+ } ) ;
87+
88+ it ( '/boom HTML contents' , async ( ) => {
89+ const response = await request ( {
90+ url : 'http://localhost:49741/boom' ,
91+ headers : {
92+ 'Accept' : 'text/html'
93+ }
94+ } )
95+
96+ expect ( response . statusCode ) . to . equal ( 500 ) ;
97+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
98+ expect ( response . body ) . to . contain ( "BOOM" ) ;
99+ } ) ;
100+
101+ it ( '/imports HTML contents' , async ( ) => {
102+ const response = await request ( {
103+ url : 'http://localhost:49741/imports' ,
104+ headers : {
105+ 'Accept' : 'text/html'
106+ }
107+ } )
108+
109+ expect ( response . statusCode ) . to . equal ( 200 ) ;
110+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "text/html; charset=utf-8" ) ;
111+ expect ( response . body ) . to . contain ( "FastBoot compatible vendor file: FastBoot default default value" ) ;
112+ } ) ;
113+
114+ it ( '/assets/vendor.js' , async ( ) => {
115+ const response = await request ( 'http://localhost:49741/assets/vendor.js' )
116+
117+ expect ( response . statusCode ) . to . equal ( 200 ) ;
118+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "application/javascript; charset=utf-8" ) ;
119+ expect ( response . body ) . to . contain ( "Ember =" ) ;
120+ } ) ;
121+
122+ it ( '/assets/dummy.js' , async ( ) => {
123+ const response = await request ( 'http://localhost:49741/assets/dummy.js' )
124+
125+ expect ( response . statusCode ) . to . equal ( 200 ) ;
126+ expect ( response . headers [ "content-type" ] ) . to . equalIgnoreCase ( "application/javascript; charset=utf-8" ) ;
127+ expect ( response . body ) . to . not . contain ( "autoBoot: false" ) ;
128+ } ) ;
34129} ) ;
0 commit comments