mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-26 13:14:07 -08:00
45 lines
1 KiB
TypeScript
45 lines
1 KiB
TypeScript
|
import * as helpers from '@/sso/saml/samlHelpers';
|
||
|
import type { SamlUserAttributes } from '@/sso/saml/types/samlUserAttributes';
|
||
|
import { getPersonalProject } from '../../integration/shared/db/projects';
|
||
|
|
||
|
import * as testDb from '../shared/testDb';
|
||
|
|
||
|
beforeAll(async () => {
|
||
|
await testDb.init();
|
||
|
});
|
||
|
|
||
|
afterAll(async () => {
|
||
|
await testDb.terminate();
|
||
|
});
|
||
|
|
||
|
describe('sso/saml/samlHelpers', () => {
|
||
|
describe('createUserFromSamlAttributes', () => {
|
||
|
test('Creates personal project for user', async () => {
|
||
|
//
|
||
|
// ARRANGE
|
||
|
//
|
||
|
const samlUserAttributes: SamlUserAttributes = {
|
||
|
firstName: 'Nathan',
|
||
|
lastName: 'Nathaniel',
|
||
|
email: 'n@8.n',
|
||
|
userPrincipalName: 'Huh?',
|
||
|
};
|
||
|
|
||
|
//
|
||
|
// ACT
|
||
|
//
|
||
|
const user = await helpers.createUserFromSamlAttributes(samlUserAttributes);
|
||
|
|
||
|
//
|
||
|
// ASSERT
|
||
|
//
|
||
|
expect(user).toMatchObject({
|
||
|
firstName: samlUserAttributes.firstName,
|
||
|
lastName: samlUserAttributes.lastName,
|
||
|
email: samlUserAttributes.email,
|
||
|
});
|
||
|
await expect(getPersonalProject(user)).resolves.not.toBeNull();
|
||
|
});
|
||
|
});
|
||
|
});
|