import { Principal , securityId , UserProfile } from '@loopback/security' ; import { expect } from '@loopback/testlab' ; import { createPrincipalFromUserProfile } from '../../util' ; describe ( 'utils' , ( ) => { it ( 'generates the correct principal' , ( ) => { const userProfile = { [ securityId ] : 'auser' , email : 'test@fake.com' , } ; const expectedPrincipal = { [ securityId ] : 'auser' , email : 'test@fake.com' , name : 'auser' , type : 'USER' , } ; expect ( createPrincipalFromUserProfile ( userProfile ) ) . to . deepEqual ( expectedPrincipal ) ; } ) ; } ) ;