File size: 1,220 Bytes
3206347
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { describe, it, expect, beforeEach } from 'vitest';
import { createSamlAuthProvider } from '../../test/factories/saml-auth-provider.ee.js';
import adminSamlAuthProviderSerializer from './admin-saml-auth-provider.ee.js';

describe('adminSamlAuthProviderSerializer', () => {
  let samlAuthProvider;

  beforeEach(async () => {
    samlAuthProvider = await createSamlAuthProvider();
  });

  it('should return saml auth provider data', async () => {
    const expectedPayload = {
      id: samlAuthProvider.id,
      name: samlAuthProvider.name,
      certificate: samlAuthProvider.certificate,
      signatureAlgorithm: samlAuthProvider.signatureAlgorithm,
      issuer: samlAuthProvider.issuer,
      entryPoint: samlAuthProvider.entryPoint,
      firstnameAttributeName: samlAuthProvider.firstnameAttributeName,
      surnameAttributeName: samlAuthProvider.surnameAttributeName,
      emailAttributeName: samlAuthProvider.emailAttributeName,
      roleAttributeName: samlAuthProvider.roleAttributeName,
      active: samlAuthProvider.active,
      defaultRoleId: samlAuthProvider.defaultRoleId,
    };

    expect(adminSamlAuthProviderSerializer(samlAuthProvider)).toEqual(
      expectedPayload
    );
  });
});