@@ -9,6 +9,7 @@ const fs = require('fs-extra')
99
1010describe ( 'AccountManager (OIDC account creation tests)' , function ( ) {
1111 process . env . NODE_TLS_REJECT_UNAUTHORIZED = '0'
12+ this . timeout ( 10000 )
1213
1314 var serverUri = 'https://localhost:3457'
1415 var host = 'localhost:3457'
@@ -200,3 +201,51 @@ describe('AccountManager (OIDC account creation tests)', function () {
200201 } )
201202 } )
202203} )
204+
205+ describe ( 'Single User signup page' , ( ) => {
206+ const serverUri = 'https://localhost:7457'
207+ const port = 7457
208+ var ldpHttpsServer
209+ const rootDir = path . join ( __dirname , '/resources/accounts/single-user/' )
210+ const ldp = ldnode . createServer ( {
211+ port,
212+ root : rootDir ,
213+ sslKey : path . join ( __dirname , '/keys/key.pem' ) ,
214+ sslCert : path . join ( __dirname , '/keys/cert.pem' ) ,
215+ webid : true ,
216+ idp : false ,
217+ strictOrigin : true
218+ } )
219+ const server = supertest ( serverUri )
220+
221+ before ( function ( done ) {
222+ ldpHttpsServer = ldp . listen ( port , done )
223+ } )
224+
225+ after ( function ( ) {
226+ if ( ldpHttpsServer ) ldpHttpsServer . close ( )
227+ fs . removeSync ( path . join ( rootDir ) )
228+ } )
229+
230+ it ( 'should return a 401 unauthorized without accept text/html' , done => {
231+ server . get ( '/' )
232+ . set ( 'accept' , 'text/plain' )
233+ . expect ( 401 )
234+ . end ( done )
235+ } )
236+
237+ it ( 'should redirect to signup with accept text/html' , done => {
238+ server . get ( '/' )
239+ . set ( 'accept' , 'text/html' )
240+ . expect ( 302 )
241+ . expect ( 'location' , '/signup.html' )
242+ . end ( done )
243+ } )
244+
245+ it ( 'it should serve the signup page' , done => {
246+ server . get ( '/signup.html' )
247+ . expect ( 200 )
248+ . expect ( / < t i t l e > A d m i n S i g n u p < \/ t i t l e > / )
249+ . end ( done )
250+ } )
251+ } )
0 commit comments