fix tests

This commit is contained in:
Denys Vuika
2023-05-19 10:37:12 +01:00
parent e615ad6707
commit f0418d41d5
3 changed files with 24 additions and 3 deletions

View File

@@ -550,8 +550,13 @@ describe('app.evaluators', () => {
}); });
describe('canOpenWithOffice', () => { describe('canOpenWithOffice', () => {
const appConfig = {
get: (key: string) => key
};
it('should return [false] if using SSO', () => { it('should return [false] if using SSO', () => {
const context: any = { const context: any = {
appConfig,
auth: { auth: {
isOauth: () => true isOauth: () => true
} }
@@ -562,6 +567,7 @@ describe('app.evaluators', () => {
it('should return [false] if no selection present', () => { it('should return [false] if no selection present', () => {
const context: any = { const context: any = {
appConfig,
selection: null selection: null
}; };
@@ -570,6 +576,7 @@ describe('app.evaluators', () => {
it('should return [false] if no file selected', () => { it('should return [false] if no file selected', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: null file: null
} }
@@ -580,6 +587,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has no entry', () => { it('should return [false] if selected file has no entry', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: null entry: null
@@ -592,6 +600,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has no properties', () => { it('should return [false] if selected file has no properties', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -606,6 +615,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file is locked', () => { it('should return [false] if selected file is locked', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -621,6 +631,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has no extension', () => { it('should return [false] if selected file has no extension', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -637,6 +648,7 @@ describe('app.evaluators', () => {
it('should return [false] if extension is not supported', () => { it('should return [false] if extension is not supported', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -653,6 +665,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has write lock', () => { it('should return [false] if selected file has write lock', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -671,6 +684,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has read-only lock', () => { it('should return [false] if selected file has read-only lock', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -689,6 +703,7 @@ describe('app.evaluators', () => {
it('should return [false] if current user is not lock owner', () => { it('should return [false] if current user is not lock owner', () => {
const context: any = { const context: any = {
appConfig,
profile: { profile: {
id: 'user1' id: 'user1'
}, },
@@ -713,6 +728,7 @@ describe('app.evaluators', () => {
it('should return [false] if current user is lock owner', () => { it('should return [false] if current user is lock owner', () => {
const context: any = { const context: any = {
appConfig,
profile: { profile: {
id: 'user1' id: 'user1'
}, },
@@ -737,6 +753,7 @@ describe('app.evaluators', () => {
it('should return [false] if permissions check is false', () => { it('should return [false] if permissions check is false', () => {
const context: any = { const context: any = {
appConfig,
selection: { selection: {
file: { file: {
entry: { entry: {
@@ -756,6 +773,9 @@ describe('app.evaluators', () => {
it('should return [true] if all checks succeed', () => { it('should return [true] if all checks succeed', () => {
const context: any = { const context: any = {
appConfig: {
get: () => true
},
selection: { selection: {
file: { file: {
entry: { entry: {

View File

@@ -583,8 +583,9 @@ export const showInfoSelectionButton = (context: RuleContext): boolean => naviga
* @param context Rule execution context * @param context Rule execution context
*/ */
export function canOpenWithOffice(context: AcaRuleContext): boolean { export function canOpenWithOffice(context: AcaRuleContext): boolean {
const flag = context.appConfig.get<boolean | string>('plugins.aosPlugin'); const flag = `${context.appConfig.get<boolean | string>('plugins.aosPlugin', false)}`;
if (flag === false || flag !== 'true') {
if (flag !== 'true') {
return false; return false;
} }

View File

@@ -45,7 +45,7 @@ describe('AcaMobileAppSwitcherService', () => {
}); });
appConfig = TestBed.inject(AppConfigService); appConfig = TestBed.inject(AppConfigService);
appConfig.config.mobileAppSwitch = { appConfig.config.mobileAppSwitch = {
enabled: 'true', enabled: true,
iphoneUrl: 'iosamw://', iphoneUrl: 'iosamw://',
androidUrlPart1: 'intent:///', androidUrlPart1: 'intent:///',
androidUrlPart2: '#Intent;scheme=androidamw;package=com.alfresco.content.app;end', androidUrlPart2: '#Intent;scheme=androidamw;package=com.alfresco.content.app;end',