n8n/packages/cli/test/integration/saml/saml-helpers.test.ts
Iván Ovejero f754b22a3f
Some checks failed
Test Master / install-and-build (push) Has been cancelled
Test Master / Unit tests (18.x) (push) Has been cancelled
Test Master / Unit tests (20.x) (push) Has been cancelled
Test Master / Unit tests (22.4) (push) Has been cancelled
Test Master / Lint (push) Has been cancelled
Test Master / Notify Slack on failure (push) Has been cancelled
refactor(core): Mark all backend Enterprise Edition files and dirs (#12350)
2024-12-24 13:02:05 +01:00

45 lines
1 KiB
TypeScript

import * as helpers from '@/sso.ee/saml/saml-helpers';
import type { SamlUserAttributes } from '@/sso.ee/saml/types/saml-user-attributes';
import { getPersonalProject } from '../shared/db/projects';
import * as testDb from '../shared/test-db';
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();
});
});
});