Skip to content

Commit

Permalink
feat(changelog): add party groups and roles schema fields
Browse files Browse the repository at this point in the history
  • Loading branch information
lykmapipo committed Dec 7, 2019
1 parent 3976bf5 commit 3b55b8c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/changelog.model.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,15 @@ import {
CHANGELOG_USES,
} from './internals';

import { initiator, verifier, agencies, focals } from './schema/parties.schema';
import {
initiator,
verifier,
groups,
roles,
agencies,
focals,
} from './schema/parties.schema';

import { group, type, fanction, action } from './schema/base.schema';
import { event, use, comment } from './schema/changelog.base.schema';
import { image, audio, video, document } from './schema/files.schema';
Expand All @@ -27,7 +35,7 @@ const SCHEMA = mergeObjects(
{ group, type },
{ event },
{ function: fanction, action },
{ agencies, focals },
{ groups, roles, agencies, focals },
{ comment },
{ image, audio, video, document }
);
Expand Down
38 changes: 38 additions & 0 deletions test/unit/changelog.schema.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,44 @@ describe('ChangeLog Schema', () => {
expect(action.options.default).to.be.undefined;
});

it('should have groups field', () => {
const groups = ChangeLog.path('groups');

expect(groups).to.exist;
expect(groups).to.be.instanceof(SchemaTypes.Array);
expect(groups.options).to.exist;
expect(groups.options).to.be.an('object');
expect(groups.options.type).to.exist;
expect(groups.options.ref).to.exist;
expect(groups.options.ref).to.be.equal(Predefine.MODEL_NAME);
// expect(groups.options.required).to.be.true;
expect(groups.options.exists).to.be.true;
expect(groups.options.autopopulate).to.exist;
expect(groups.options.taggable).to.exist;
expect(groups.options.exportable).to.exist;
// expect(groups.options.aggregatable).to.exist;
expect(groups.options.default).to.be.undefined;
});

it('should have roles field', () => {
const roles = ChangeLog.path('roles');

expect(roles).to.exist;
expect(roles).to.be.instanceof(SchemaTypes.Array);
expect(roles.options).to.exist;
expect(roles.options).to.be.an('object');
expect(roles.options.type).to.exist;
expect(roles.options.ref).to.exist;
expect(roles.options.ref).to.be.equal(Predefine.MODEL_NAME);
// expect(roles.options.required).to.be.true;
expect(roles.options.exists).to.be.true;
expect(roles.options.autopopulate).to.exist;
expect(roles.options.taggable).to.exist;
expect(roles.options.exportable).to.exist;
// expect(roles.options.aggregatable).to.exist;
expect(roles.options.default).to.be.undefined;
});

it('should have agencies field', () => {
const agencies = ChangeLog.path('agencies');

Expand Down

0 comments on commit 3b55b8c

Please sign in to comment.