Skip to content

Commit

Permalink
Add tests for organization owner check
Browse files Browse the repository at this point in the history
  • Loading branch information
MrBartusek committed Jun 3, 2024
1 parent f050463 commit 712bc20
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('OrganizationsController', () => {
settings: dto,
};
}),
isUserOwnerOfAny: jest.fn(() => true),
};

const mockAclService = {
Expand Down Expand Up @@ -110,6 +111,12 @@ describe('OrganizationsController', () => {
);
});

it('should check is user owner of any org', async () => {
const result = await controller.ownerCheck(mockUserRequest);

expect(result.response).toBe(true);
});

it('should update organization', async () => {
const org = await controller.update(new Types.ObjectId(), {
name: 'updated-org',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ describe('OrganizationsService', () => {
expect(taken).toBe(true);
});

it('should check if user is owner of any org', async () => {
const result = await service.isUserOwnerOfAny(new Types.ObjectId());
expect(result).toBe(true);
});

it('should update organization settings', async () => {
const org = await service.updateSettings(new Types.ObjectId(), {
valueCalculationStrategy: OrgValueCalculationStrategy.SellPrice,
Expand Down

0 comments on commit 712bc20

Please sign in to comment.