mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
refactor(core): Separate license state from license service (#15097)
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { LicenseProvider, LicenseState } from '@n8n/backend-common';
|
||||
import type { BooleanLicenseFeature, NumericLicenseFeature } from '@n8n/constants';
|
||||
|
||||
import type { License } from '@/license';
|
||||
@@ -17,8 +18,17 @@ export class LicenseMocker {
|
||||
private _defaultQuotas: Map<NumericLicenseFeature, number> = new Map();
|
||||
|
||||
mock(license: License) {
|
||||
license.isFeatureEnabled = this.isFeatureEnabled.bind(this);
|
||||
license.getFeatureValue = this.getFeatureValue.bind(this);
|
||||
license.isLicensed = this.isFeatureEnabled.bind(this);
|
||||
license.getValue = this.getFeatureValue.bind(this);
|
||||
}
|
||||
|
||||
mockLicenseState(licenseState: LicenseState) {
|
||||
const licenseProvider: LicenseProvider = {
|
||||
isLicensed: this.isFeatureEnabled.bind(this),
|
||||
getValue: this.getFeatureValue.bind(this),
|
||||
};
|
||||
|
||||
licenseState.setLicenseProvider(licenseProvider);
|
||||
}
|
||||
|
||||
reset() {
|
||||
|
||||
Reference in New Issue
Block a user