Skip to content

Commit

Permalink
add cog business rule test
Browse files Browse the repository at this point in the history
  • Loading branch information
sharadsw committed Sep 20, 2024
1 parent 2658814 commit 58a2573
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,30 @@ describe('Collection Object business rules', () => {
});
});

describe('CollectionObjectGroup business rules', () => {
test('Only one CO COJO can be primary', () => {
const cog = new tables.CollectionObjectGroup.Resource({
id: 1,
cogType: getResourceApiUrl('CollectionObjectGroupType', 1),
});

const cojo1 = new tables.CollectionObjectGroupJoin.Resource({
isPrimary: true,
childCo: getResourceApiUrl('CollectionObject', 1),
parentCog: getResourceApiUrl('CollectionObjectGroup', 1),
});
const cojo2 = new tables.CollectionObjectGroupJoin.Resource({
isPrimary: false,
childCo: getResourceApiUrl('CollectionObject', 2),
parentCog: getResourceApiUrl('CollectionObjectGroup', 1),
});
cog.set('parentCojos', [cojo1, cojo2]);
cojo2.set('isPrimary', true);

expect(cojo1.get('isPrimary')).toBe(false);
});
});

describe('DNASequence business rules', () => {
test('fieldCheck geneSequence', async () => {
const dNASequence = new tables.DNASequence.Resource({
Expand Down

0 comments on commit 58a2573

Please sign in to comment.