This commit is contained in:
althaf.hameez
2020-08-12 19:23:43 +08:00
parent c9cd3e1354
commit c898200065
2 changed files with 8 additions and 8 deletions
@@ -38,7 +38,7 @@ describe('GroupV1alpha1Policy', () => {
parent: 'group-a',
ancestors: ['group-a', 'global-synergies', 'acme-corp'],
children: ['child-a', 'child-b'],
descendents: ['desc-a', 'desc-b'],
descendants: ['desc-a', 'desc-b'],
},
};
policy = new GroupEntityV1alpha1Policy();
@@ -108,13 +108,13 @@ describe('GroupV1alpha1Policy', () => {
await expect(policy.enforce(entity)).resolves.toBe(entity);
});
it('rejects missing descendents', async () => {
delete (entity as any).spec.descendents;
await expect(policy.enforce(entity)).rejects.toThrow(/descendents/);
it('rejects missing descendants', async () => {
delete (entity as any).spec.descendants;
await expect(policy.enforce(entity)).rejects.toThrow(/descendants/);
});
it('accepts empty descendents', async () => {
(entity as any).spec.descendents = [''];
it('accepts empty descendants', async () => {
(entity as any).spec.descendants = [''];
await expect(policy.enforce(entity)).resolves.toBe(entity);
});
});
@@ -29,7 +29,7 @@ export interface GroupEntityV1alpha1 extends Entity {
parent?: string;
ancestors: string[];
children: string[];
descendents: string[];
descendants: string[];
};
}
@@ -46,7 +46,7 @@ export class GroupEntityV1alpha1Policy implements EntityPolicy {
parent: yup.string().notRequired().min(1),
ancestors: yup.array(yup.string()).required(),
children: yup.array(yup.string()).required(),
descendents: yup.array(yup.string()).required(),
descendants: yup.array(yup.string()).required(),
})
.required(),
});