Skip to content

Commit

Permalink
Increase MOAR
Browse files Browse the repository at this point in the history
  • Loading branch information
d-gubert committed Oct 4, 2024
1 parent ecc58b2 commit 17a7408
Showing 1 changed file with 32 additions and 8 deletions.
40 changes: 32 additions & 8 deletions ee/packages/license/src/modules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,29 +19,45 @@ describe('getModules', () => {
});

describe('getModuleDefinition', () => {
let licenseManager: LicenseImp;

beforeEach(async () => {
licenseManager = await getReadyLicenseManager();
it('should not return `external` property for an internal module', async () => {
const licenseManager = await getReadyLicenseManager();

const license = await new MockedLicenseBuilder().withGratedModules(['auditing', 'chat.rocket.test-addon']).sign();

await licenseManager.setLicense(license);
});

it('should not return `external` property for an internal module', () => {
const module = licenseManager.getModuleDefinition('auditing');

expect(module).toMatchObject({ module: 'auditing' });
});

it('should return `undefined` for a non-existing module', () => {
it('should return `undefined` for a non-existing module', async () => {
const licenseManager = await getReadyLicenseManager();

const license = await new MockedLicenseBuilder().withGratedModules(['auditing', 'chat.rocket.test-addon']).sign();

await licenseManager.setLicense(license);

const module = licenseManager.getModuleDefinition('livechat-enterprise');

expect(module).toBeUndefined();
});

it('should return `external` property for an external module', () => {
it('should return `undefined` if there is no license available', async () => {
const licenseManager = await getReadyLicenseManager();

const module = licenseManager.getModuleDefinition('livechat-enterprise');

expect(module).toBeUndefined();
});

it('should return `external` property for an external module', async () => {
const licenseManager = await getReadyLicenseManager();

const license = await new MockedLicenseBuilder().withGratedModules(['auditing', 'chat.rocket.test-addon']).sign();

await licenseManager.setLicense(license);

const module = licenseManager.getModuleDefinition('chat.rocket.test-addon');

expect(module).toMatchObject({ module: 'chat.rocket.test-addon', external: true });
Expand Down Expand Up @@ -73,4 +89,12 @@ describe('getExternalModules', () => {

expect(modules).toHaveLength(0);
});

it('should return empty array if license is not available', async () => {
const licenseManager = await getReadyLicenseManager();

const modules = licenseManager.getExternalModules();

expect(modules).toHaveLength(0);
});
});

0 comments on commit 17a7408

Please sign in to comment.