refactor(core): Reduce boilterplate code in between tests also cleaned up some imports, and fixed the tests in node.js 20
27 lines
700 B
TypeScript
27 lines
700 B
TypeScript
import { Container } from 'typedi';
|
|
import { License } from '@/License';
|
|
|
|
export function isVariablesEnabled(): boolean {
|
|
const license = Container.get(License);
|
|
return license.isVariablesEnabled();
|
|
}
|
|
|
|
export function canCreateNewVariable(variableCount: number): boolean {
|
|
if (!isVariablesEnabled()) {
|
|
return false;
|
|
}
|
|
const license = Container.get(License);
|
|
// This defaults to -1 which is what we want if we've enabled
|
|
// variables via the config
|
|
const limit = license.getVariablesLimit();
|
|
if (limit === -1) {
|
|
return true;
|
|
}
|
|
return limit > variableCount;
|
|
}
|
|
|
|
export function getVariablesLimit(): number {
|
|
const license = Container.get(License);
|
|
return license.getVariablesLimit();
|
|
}
|