more test
This commit is contained in:
@@ -47,6 +47,7 @@ describe('UmbExtensionRegistry', () => {
|
||||
type: 'workspace',
|
||||
name: 'test-editor-1',
|
||||
alias: 'Umb.Test.Editor.1',
|
||||
weight: 2,
|
||||
meta: {
|
||||
entityType: 'testEntity',
|
||||
},
|
||||
@@ -77,6 +78,17 @@ describe('UmbExtensionRegistry', () => {
|
||||
});
|
||||
|
||||
it('should get an extension by alias', (done) => {
|
||||
const alias = 'Umb.Test.Section.1';
|
||||
extensionRegistry
|
||||
.byAlias(alias)
|
||||
.subscribe((extension) => {
|
||||
expect(extension?.alias).to.eq(alias);
|
||||
done();
|
||||
})
|
||||
.unsubscribe();
|
||||
});
|
||||
|
||||
it('should get an extension by type and alias', (done) => {
|
||||
const alias = 'Umb.Test.Section.1';
|
||||
extensionRegistry
|
||||
.byTypeAndAlias('section', alias)
|
||||
@@ -190,6 +202,37 @@ describe('UmbExtensionRegistry', () => {
|
||||
.unsubscribe();
|
||||
});
|
||||
});
|
||||
|
||||
describe('byTypes', () => {
|
||||
const types = ['section', 'workspace'];
|
||||
|
||||
it('should get all extensions of the given types', (done) => {
|
||||
extensionRegistry
|
||||
.byTypes(types)
|
||||
.subscribe((extensions) => {
|
||||
expect(extensions).to.have.lengthOf(4);
|
||||
expect(extensions?.[0]?.type).to.eq('section');
|
||||
expect(extensions?.[1]?.type).to.eq('section');
|
||||
expect(extensions?.[2]?.type).to.eq('workspace');
|
||||
expect(extensions?.[3]?.type).to.eq('section');
|
||||
done();
|
||||
})
|
||||
.unsubscribe();
|
||||
});
|
||||
|
||||
it('should return extensions ordered by weight', (done) => {
|
||||
extensionRegistry
|
||||
.byTypes(types)
|
||||
.subscribe((extensions) => {
|
||||
expect(extensions?.[0]?.weight).to.eq(200);
|
||||
expect(extensions?.[1]?.weight).to.eq(25);
|
||||
expect(extensions?.[2]?.weight).to.eq(2);
|
||||
expect(extensions?.[3]?.weight).to.eq(1);
|
||||
done();
|
||||
})
|
||||
.unsubscribe();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('UmbExtensionRegistry with kinds', () => {
|
||||
|
||||
Reference in New Issue
Block a user