@@ -72,16 +72,36 @@ describe('AngularTokenService', () => {
7272 passwordConfirmation : 'password'
7373 } ;
7474
75+ // Register test data
76+ const registerCustomFieldsData : RegisterData = {
77+ login : 'test@test.de' ,
78+ first_name : 'John' ,
79+ last_name : 'Doe' ,
80+ password : 'password' ,
81+ passwordConfirmation : 'password'
82+ } ;
83+
84+ const registerCustomFieldsDataOutput = {
85+ email : 'test@test.de' ,
86+ first_name : 'John' ,
87+ last_name : 'Doe' ,
88+ password : 'password' ,
89+ password_confirmation : 'password' ,
90+ confirm_success_url : window . location . href
91+ } ;
92+
7593 const registerDataOutput = {
7694 email : 'test@test.de' ,
7795 password : 'password' ,
78- password_confirmation : 'password'
96+ password_confirmation : 'password' ,
97+ confirm_success_url : window . location . href
7998 } ;
8099
81100 const registerCustomDataOutput = {
82101 username : 'test@test.de' ,
83102 password : 'password' ,
84- password_confirmation : 'password'
103+ password_confirmation : 'password' ,
104+ confirm_success_url : window . location . href
85105 } ;
86106
87107 // Update password data
@@ -236,16 +256,31 @@ describe('AngularTokenService', () => {
236256 } ) ;
237257 } ) ;
238258
239- it ( 'registerAccount should POST data' , ( ) => {
259+ describe ( 'registerAccount should POST data' , ( ) => {
260+ it ( 'with standard fields' , ( ) => {
240261
241- service . registerAccount ( registerData ) . subscribe ( ) ;
262+ service . registerAccount ( registerData ) . subscribe ( ) ;
242263
243- const req = backend . expectOne ( {
244- url : 'auth' ,
245- method : 'POST'
264+ const req = backend . expectOne ( {
265+ url : 'auth' ,
266+ method : 'POST'
267+ } ) ;
268+
269+ expect ( req . request . body ) . toEqual ( registerDataOutput ) ;
270+ } ) ;
271+
272+ it ( 'with custom fields' , ( ) => {
273+
274+ service . registerAccount ( registerCustomFieldsData ) . subscribe ( ) ;
275+
276+ const req = backend . expectOne ( {
277+ url : 'auth' ,
278+ method : 'POST'
279+ } ) ;
280+
281+ expect ( req . request . body ) . toEqual ( registerCustomFieldsDataOutput ) ;
246282 } ) ;
247283
248- expect ( req . request . body ) . toEqual ( registerDataOutput ) ;
249284 } ) ;
250285
251286 it ( 'validateToken should GET' , ( ) => {
0 commit comments