Skip to content

Commit

Permalink
[ACS-8694] Code review finding - Replaced instance of any
Browse files Browse the repository at this point in the history
  • Loading branch information
swapnil-verma-gl committed Nov 4, 2024
1 parent ad392c7 commit 104e438
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions projects/aca-shared/rules/src/app.rules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
*/

import * as app from './app.rules';
import { getFileExtension } from './app.rules';
import { TestRuleContext } from './test-rule-context';
import { NodeEntry, RepositoryInfo, StatusInfo } from '@alfresco/js-api';
import { getFileExtension } from './app.rules';
import { ProfileState } from '@alfresco/adf-extensions';
import { AppConfigService } from '@alfresco/adf-core';

describe('app.evaluators', () => {
Expand Down Expand Up @@ -1149,30 +1150,30 @@ describe('app.evaluators', () => {

describe('canToggleFileLock', () => {
beforeEach(() => {
context.profile = {} as any;
context.profile = {} as ProfileState;
});

it('should return false when permission requirements are not met, regardless of file lock', () => {
context.selection.file = { entry: { properties: { 'cm:lockType': 'WRITE_LOCK', 'cm:lockOwner': { id: 'test' } } } } as any;
context.selection.file = { entry: { properties: { 'cm:lockType': 'WRITE_LOCK', 'cm:lockOwner': { id: 'test' } } } } as NodeEntry;
context.permissions = { check: () => false };
expect(app.canToggleFileLock(context)).toBeFalse();
});

it('should return true when file has no lock and permission requirements are met', () => {
context.selection.file = { entry: { properties: {} } } as any;
context.selection.file = { entry: { properties: {} } } as NodeEntry;
context.permissions = { check: () => true };
expect(app.canToggleFileLock(context)).toBeTrue();
});

it('should return true when file is locked and permission requirements are met', () => {
context.selection.file = { entry: { properties: { 'cm:lockType': 'WRITE_LOCK', 'cm:lockOwner': { id: 'test' } } } } as any;
context.selection.file = { entry: { properties: { 'cm:lockType': 'WRITE_LOCK', 'cm:lockOwner': { id: 'test' } } } } as NodeEntry;
context.profile.id = 'test1';
context.permissions = { check: () => true };
expect(app.canToggleFileLock(context)).toBeTrue();
});

it('should return true when file is locked and user is the owner of the lock', () => {
context.selection.file = { entry: { properties: { 'cm:lockType': 'WRITE_LOCK', 'cm:lockOwner': { id: 'test1' } } } } as any;
context.selection.file = { entry: { properties: { 'cm:lockType': 'WRITE_LOCK', 'cm:lockOwner': { id: 'test1' } } } } as NodeEntry;
context.profile.id = 'test1';
context.permissions = { check: () => false };
expect(app.canToggleFileLock(context)).toBeTrue();
Expand Down

0 comments on commit 104e438

Please sign in to comment.