mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Fixed unit test
This commit is contained in:
@@ -89,9 +89,16 @@ describe('ExtensionLoaderService', () => {
|
|||||||
const pluginsReference = config.$references.map((entry: ExtensionConfig) => entry.$name);
|
const pluginsReference = config.$references.map((entry: ExtensionConfig) => entry.$name);
|
||||||
expect(pluginsReference).toEqual(['test.extension.1']);
|
expect(pluginsReference).toEqual(['test.extension.1']);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it('should load extensions from passed extension value', (done) => {
|
httpMock.expectOne('assets/app.extensions.json').flush(appExtensionsConfig);
|
||||||
|
tick();
|
||||||
|
httpMock.expectOne('assets/plugins/test.extension.1.json').flush(pluginConfig1);
|
||||||
|
httpMock.expectNone('assets/plugins/test.extension.2.json');
|
||||||
|
httpMock.expectNone('assets/plugins/test.extension.3.json');
|
||||||
|
flushMicrotasks();
|
||||||
|
}));
|
||||||
|
|
||||||
|
it('should load extensions from passed extension value',fakeAsync(() => {
|
||||||
appExtensionsConfig.$references = ['test.extension.1.json'];
|
appExtensionsConfig.$references = ['test.extension.1.json'];
|
||||||
|
|
||||||
extensionLoaderService.load(
|
extensionLoaderService.load(
|
||||||
@@ -107,11 +114,14 @@ describe('ExtensionLoaderService', () => {
|
|||||||
}]).then((config: ExtensionConfig) => {
|
}]).then((config: ExtensionConfig) => {
|
||||||
const hasExtensionValue = config.$references.some((entry: ExtensionConfig) => entry.$id === 'extension-value-id');
|
const hasExtensionValue = config.$references.some((entry: ExtensionConfig) => entry.$id === 'extension-value-id');
|
||||||
expect(hasExtensionValue).toBe(true);
|
expect(hasExtensionValue).toBe(true);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
httpMock.expectOne('assets/app.extensions.json').flush(appExtensionsConfig);
|
||||||
|
tick();
|
||||||
|
httpMock.expectOne('assets/plugins/test.extension.1.json').flush(pluginConfig1);
|
||||||
|
flushMicrotasks();
|
||||||
|
}));
|
||||||
|
|
||||||
it('should load extensions if only extension value was passed', (done) => {
|
it('should load extensions if only extension value was passed', fakeAsync(() => {
|
||||||
extensionLoaderService.load(
|
extensionLoaderService.load(
|
||||||
'assets/app.extensions.json',
|
'assets/app.extensions.json',
|
||||||
'assets/plugins',
|
'assets/plugins',
|
||||||
@@ -125,11 +135,13 @@ describe('ExtensionLoaderService', () => {
|
|||||||
}]).then((config: ExtensionConfig) => {
|
}]).then((config: ExtensionConfig) => {
|
||||||
const hasExtensionValue = config.$references.some((entry: ExtensionConfig) => entry.$id === 'extension-value-id');
|
const hasExtensionValue = config.$references.some((entry: ExtensionConfig) => entry.$id === 'extension-value-id');
|
||||||
expect(hasExtensionValue).toBe(true);
|
expect(hasExtensionValue).toBe(true);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
httpMock.expectOne('assets/app.extensions.json').flush(appExtensionsConfig);
|
||||||
|
tick();
|
||||||
|
flushMicrotasks();
|
||||||
|
}));
|
||||||
|
|
||||||
it('should load extensions with multiple extension values', (done) => {
|
it('should load extensions with multiple extension values', fakeAsync(() => {
|
||||||
appExtensionsConfig.$references = ['test.extension.1.json'];
|
appExtensionsConfig.$references = ['test.extension.1.json'];
|
||||||
|
|
||||||
extensionLoaderService.load(
|
extensionLoaderService.load(
|
||||||
@@ -153,7 +165,10 @@ describe('ExtensionLoaderService', () => {
|
|||||||
expect(hasFirstExtensionValue).toBe(true);
|
expect(hasFirstExtensionValue).toBe(true);
|
||||||
const hasSecondExtensionValue = config.$references.some((entry: ExtensionConfig) => entry.$id === 'extension-value-id-2');
|
const hasSecondExtensionValue = config.$references.some((entry: ExtensionConfig) => entry.$id === 'extension-value-id-2');
|
||||||
expect(hasSecondExtensionValue).toBe(true);
|
expect(hasSecondExtensionValue).toBe(true);
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
});
|
httpMock.expectOne('assets/app.extensions.json').flush(appExtensionsConfig);
|
||||||
|
tick();
|
||||||
|
httpMock.expectOne('assets/plugins/test.extension.1.json').flush(pluginConfig1);
|
||||||
|
flushMicrotasks();
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user