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

View File

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

View File

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