Skip to content

Commit

Permalink
Merge pull request opossum-tool#2056 from benedikt-richter/add_featur…
Browse files Browse the repository at this point in the history
…e_flag

Add feature flag
  • Loading branch information
benedikt-richter authored Sep 27, 2023
2 parents 9fb2bb8 + 1882d0c commit cbc7074
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ describe('The App in Audit View', () => {
);
});

it('preferred button is shown and sets an attribution as preferred', () => {
it.skip('preferred button is shown and sets an attribution as preferred', () => {
function getExpectedSaveFileArgs(
preferred: boolean,
preferredOverOriginIds?: Array<string>,
Expand Down Expand Up @@ -673,7 +673,7 @@ describe('The App in Audit View', () => {
expect(window.electronAPI.saveFile).toHaveBeenCalledTimes(2);
});

it('after setting an attribution to preferred, global save is disabled', () => {
it.skip('after setting an attribution to preferred, global save is disabled', () => {
const testResources: Resources = {
file: 1,
other_file: 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ describe('loadFromFile', () => {
expect(getExternalAttributionsToHashes(testStore.getState())).toEqual(
expectedExternalAttributionsToHashes,
);
expect(getIsPreferenceFeatureEnabled(testStore.getState())).toEqual(true);
expect(getIsPreferenceFeatureEnabled(testStore.getState())).toEqual(false);
});

it('disables the preference feature if no external source is relevant', () => {
Expand Down
8 changes: 7 additions & 1 deletion src/Frontend/state/actions/resource-actions/load-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import { AppThunkAction, AppThunkDispatch } from '../../types';
import {
setAttributionBreakpoints,
setBaseUrlsForSources,
setIsPreferenceFeatureEnabled,
setExternalAttributionSources,
setExternalAttributionsToHashes,
setExternalData,
setFilesWithChildren,
setFrequentLicenses,
setIsPreferenceFeatureEnabled,
setManualData,
setProjectMetadata,
setResources,
Expand Down Expand Up @@ -67,6 +67,12 @@ export function loadFromFile(
setIsPreferenceFeatureEnabled(fileContainsSourcesRelevantForPreferred),
);

// Feature flag
// when removing unskip the following tests
// * after setting an attribution to preferred, global save is disabled
// * preferred button is shown and sets an attribution as preferred
dispatch(setIsPreferenceFeatureEnabled(false));

parsedFileContent.resolvedExternalAttributions.forEach((attribution) =>
dispatch(addResolvedExternalAttribution(attribution)),
);
Expand Down

0 comments on commit cbc7074

Please sign in to comment.