Commit 1826e08f authored by mo khan's avatar mo khan

Remove usage of feature flag

parent 5f6b6c8f
export default class {
static isEnabled(featureName) {
return gon && gon.features && gon.features[featureName];
}
}
...@@ -7,7 +7,7 @@ export default class V2 { ...@@ -7,7 +7,7 @@ export default class V2 {
return { return {
licenses: this.licenses, licenses: this.licenses,
dependencies: report.dependencies.map(x => this.mapFromDependency(x)), dependencies: report.dependencies.map(v2Dependency => this.mapFromDependency(v2Dependency)),
}; };
} }
......
import V1 from './mappers/v1'; import V1 from './mappers/v1';
import V2 from './mappers/v2'; import V2 from './mappers/v2';
import FeatureFlag from '~/lib/feature_flag';
const MAPPERS = { '1': V1, '2': V2 };
export default class ReportMapper { export default class ReportMapper {
constructor(featureEnabled = FeatureFlag.isEnabled('licenseScanV2')) { constructor() {
this.featureEnabled = featureEnabled; this.mappers = { '1': V1, '2': V2 };
} }
mapFrom(reportArtifact) { mapFrom(reportArtifact) {
...@@ -15,10 +12,7 @@ export default class ReportMapper { ...@@ -15,10 +12,7 @@ export default class ReportMapper {
} }
mapperFor(majorVersion) { mapperFor(majorVersion) {
if (this.featureEnabled || majorVersion === '2') { return new this.mappers[majorVersion]();
return new MAPPERS[majorVersion]();
}
return new V1();
} }
static majorVersion(report) { static majorVersion(report) {
......
...@@ -17,11 +17,6 @@ import { ...@@ -17,11 +17,6 @@ import {
} from 'ee_spec/license_management/mock_data'; } from 'ee_spec/license_management/mock_data';
describe('utils', () => { describe('utils', () => {
beforeEach(() => {
gon.features = gon.features || {};
gon.features.licenseScanV2 = true;
});
describe('parseLicenseReportMetrics', () => { describe('parseLicenseReportMetrics', () => {
it('should return empty result, if no parameters are given', () => { it('should return empty result, if no parameters are given', () => {
const result = parseLicenseReportMetrics(); const result = parseLicenseReportMetrics();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment