Skip to content

Commit

Permalink
fix: wrong limits displayed on the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Nov 2, 2023
1 parent c4a614d commit 0157781
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ee/packages/license/src/deprecated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getModules } from './modules';
import { defaultLimits } from './validation/validateDefaultLimits';

export const getLicenseLimit = (license: ILicenseV3 | undefined, kind: LicenseLimitKind) => {
const limitList = license?.limits[kind] ?? defaultLimits[kind as keyof typeof defaultLimits];
const limitList = license ? license.limits[kind] : defaultLimits[kind as keyof typeof defaultLimits];

if (!limitList?.length) {
return -1;
Expand Down
27 changes: 27 additions & 0 deletions ee/packages/license/src/getLicenseLimit.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { LicenseImp } from '.';
import { MockedLicenseBuilder, getReadyLicenseManager } from '../__tests__/MockedLicenseBuilder';
import { getAppsConfig } from './deprecated';

describe('Marketplace Restrictions', () => {
it('should respect the default if there is no license applied', async () => {
const LicenseManager = new LicenseImp();

expect(getAppsConfig.call(LicenseManager)).toEqual({
maxPrivateApps: 3,
maxMarketplaceApps: 5,
});
});

it('should return unlimited if there is license but no limits', async () => {
const licenseManager = await getReadyLicenseManager();

const license = await new MockedLicenseBuilder();

await expect(licenseManager.setLicense(await license.sign())).resolves.toBe(true);

await expect(getAppsConfig.call(licenseManager)).toEqual({
maxPrivateApps: -1,
maxMarketplaceApps: -1,
});
});
});

0 comments on commit 0157781

Please sign in to comment.