Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
45 lines
1.0 KiB
TypeScript
45 lines
1.0 KiB
TypeScript
import { getPersonalProject, testDb } from '@n8n/backend-test-utils';
|
|
|
|
import * as helpers from '@/modules/sso-saml/saml-helpers';
|
|
import type { SamlUserAttributes } from '@/modules/sso-saml/types';
|
|
|
|
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: 'nathan@n8n.io',
|
|
userPrincipalName: 'Huh?',
|
|
n8nInstanceRole: 'n8n_instance_role',
|
|
};
|
|
|
|
//
|
|
// 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();
|
|
});
|
|
});
|
|
});
|