import * as assert from 'assert' ; import { describe , it } from 'mocha' ; import { LoginTicket } from '../src/auth/loginticket' ; describe ( 'loginticket' , ( ) => { it ( 'should return null userId even if no payload' , ( ) => { const ticket = new LoginTicket ( ) ; assert . strictEqual ( ticket . getUserId ( ) , null ) ; } ) ; it ( 'should return envelope' , ( ) => { const ticket = new LoginTicket ( 'myenvelope' ) ; assert . strictEqual ( ticket . getEnvelope ( ) , 'myenvelope' ) ; } ) ; it ( 'should return attributes from getAttributes' , ( ) => { const payload = { aud : 'aud' , sub : 'sub' , iss : 'iss' , iat : 1514162443 , exp : 1514166043 , } ; const ticket = new LoginTicket ( 'myenvelope' , payload ) ; assert . deepStrictEqual ( ticket . getAttributes ( ) , { envelope : 'myenvelope' , payload , } ) ; } ) ; } ) ;