[ACS-5279] improved plugin handling (#3332)

This commit is contained in:
Denys Vuika
2023-07-12 08:27:28 +01:00
committed by GitHub
parent 1532d65a5b
commit 1963747590
11 changed files with 46 additions and 349 deletions

View File

@@ -549,26 +549,14 @@ describe('app.evaluators', () => {
});
});
describe('isContentServiceEnabled', () => {
it('should return true when local storage has contentService set to true', () => {
localStorage.setItem('contentService', 'true');
expect(app.isContentServiceEnabled()).toBe(true);
});
it('should return false when local storage has contentService set to false', () => {
localStorage.setItem('contentService', 'false');
expect(app.isContentServiceEnabled()).toBe(false);
});
it('should return true when contentService is not defined in local storage', () => {
localStorage.clear();
expect(app.isContentServiceEnabled()).toBe(true);
});
});
describe('canOpenWithOffice', () => {
const appConfig = {
get: (key: string) => key
};
it('should return [false] if using SSO', () => {
const context: any = {
appConfig,
auth: {
isOauth: () => true
}
@@ -579,6 +567,7 @@ describe('app.evaluators', () => {
it('should return [false] if no selection present', () => {
const context: any = {
appConfig,
selection: null
};
@@ -587,6 +576,7 @@ describe('app.evaluators', () => {
it('should return [false] if no file selected', () => {
const context: any = {
appConfig,
selection: {
file: null
}
@@ -597,6 +587,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has no entry', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: null
@@ -609,6 +600,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has no properties', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -623,6 +615,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file is locked', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -638,6 +631,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has no extension', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -654,6 +648,7 @@ describe('app.evaluators', () => {
it('should return [false] if extension is not supported', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -670,6 +665,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has write lock', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -688,6 +684,7 @@ describe('app.evaluators', () => {
it('should return [false] if selected file has read-only lock', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -706,6 +703,7 @@ describe('app.evaluators', () => {
it('should return [false] if current user is not lock owner', () => {
const context: any = {
appConfig,
profile: {
id: 'user1'
},
@@ -730,6 +728,7 @@ describe('app.evaluators', () => {
it('should return [false] if current user is lock owner', () => {
const context: any = {
appConfig,
profile: {
id: 'user1'
},
@@ -754,6 +753,7 @@ describe('app.evaluators', () => {
it('should return [false] if permissions check is false', () => {
const context: any = {
appConfig,
selection: {
file: {
entry: {
@@ -773,6 +773,9 @@ describe('app.evaluators', () => {
it('should return [true] if all checks succeed', () => {
const context: any = {
appConfig: {
get: () => true
},
selection: {
file: {
entry: {