test(models/saml-auth-providers-role-mapping): assert model properties
This commit is contained in:
@@ -0,0 +1,41 @@
|
|||||||
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||||
|
|
||||||
|
exports[`SamlAuthProvidersRoleMapping model > jsonSchema should have the correct schema 1`] = `
|
||||||
|
{
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"format": "uuid",
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
"remoteRoleName": {
|
||||||
|
"minLength": 1,
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
"roleId": {
|
||||||
|
"format": "uuid",
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
"samlAuthProviderId": {
|
||||||
|
"format": "uuid",
|
||||||
|
"type": "string",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"samlAuthProviderId",
|
||||||
|
"roleId",
|
||||||
|
"remoteRoleName",
|
||||||
|
],
|
||||||
|
"type": "object",
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`SamlAuthProvidersRoleMapping model > relationMappings should have samlAuthProvider relation 1`] = `
|
||||||
|
{
|
||||||
|
"join": {
|
||||||
|
"from": "saml_auth_providers_role_mappings.saml_auth_provider_id",
|
||||||
|
"to": "saml_auth_providers.id",
|
||||||
|
},
|
||||||
|
"modelClass": [Function],
|
||||||
|
"relation": [Function],
|
||||||
|
}
|
||||||
|
`;
|
@@ -0,0 +1,33 @@
|
|||||||
|
import { describe, it, expect } from 'vitest';
|
||||||
|
import SamlAuthProvidersRoleMapping from '../models/saml-auth-providers-role-mapping.ee';
|
||||||
|
import SamlAuthProvider from './saml-auth-provider.ee';
|
||||||
|
import Base from './base';
|
||||||
|
|
||||||
|
describe('SamlAuthProvidersRoleMapping model', () => {
|
||||||
|
it('tableName should return correct name', () => {
|
||||||
|
expect(SamlAuthProvidersRoleMapping.tableName).toBe(
|
||||||
|
'saml_auth_providers_role_mappings'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('jsonSchema should have the correct schema', () => {
|
||||||
|
expect(SamlAuthProvidersRoleMapping.jsonSchema).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('relationMappings should return correct associations', () => {
|
||||||
|
const relationMappings = SamlAuthProvidersRoleMapping.relationMappings();
|
||||||
|
|
||||||
|
const expectedRelations = {
|
||||||
|
samlAuthProvider: {
|
||||||
|
relation: Base.BelongsToOneRelation,
|
||||||
|
modelClass: SamlAuthProvider,
|
||||||
|
join: {
|
||||||
|
from: 'saml_auth_providers_role_mappings.saml_auth_provider_id',
|
||||||
|
to: 'saml_auth_providers.id',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(relationMappings).toStrictEqual(expectedRelations);
|
||||||
|
});
|
||||||
|
});
|
Reference in New Issue
Block a user