Skip to content

Commit

Permalink
Remove unneeded test. Fix weird dependency cycle issue'
Browse files Browse the repository at this point in the history
  • Loading branch information
marcaaron committed Jan 12, 2024
1 parent 58ba699 commit 450328c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 43 deletions.
4 changes: 2 additions & 2 deletions src/libs/HttpUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import type {RequestType} from '@src/types/onyx/Request';
import type Response from '@src/types/onyx/Response';
import * as AppUpdate from './actions/AppUpdate';
import * as UpdateRequired from './actions/UpdateRequired';
import * as NetworkActions from './actions/Network';
import * as ApiUtils from './ApiUtils';
import HttpsError from './Errors/HttpsError';
Expand Down Expand Up @@ -131,7 +131,7 @@ function processHTTPRequest(url: string, method: RequestType = 'get', body: Form
}
if (response.jsonCode === CONST.JSON_CODE.UPDATE_REQUIRED) {
// Trigger a modal and disable the app as the user needs to upgrade to the latest minimum version to continue
AppUpdate.triggerUpgradeRequired();
UpdateRequired.alertUser();
}
return response as Promise<Response>;
});
Expand Down
17 changes: 1 addition & 16 deletions src/libs/actions/AppUpdate/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import Onyx from 'react-native-onyx';
import getEnvironment from '@libs/Environment/getEnvironment';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import updateApp from './updateApp';

Expand All @@ -12,17 +10,4 @@ function setIsAppInBeta(isBeta: boolean) {
Onyx.set(ONYXKEYS.IS_BETA, isBeta);
}

function triggerUpgradeRequired() {
// For now, we will pretty much never have to do this on a platform other than production.
// We should only update the minimum app version in the API after all platforms of a new version have been deployed to PRODUCTION.
// As staging is always ahead of production there is no reason to "force update" those apps.
getEnvironment().then((environment) => {
if (environment !== CONST.ENVIRONMENT.PRODUCTION) {
return;
}

Onyx.set(ONYXKEYS.UPDATE_REQUIRED, true);
});
}

export {triggerUpdateAvailable, setIsAppInBeta, triggerUpgradeRequired, updateApp};
export {triggerUpdateAvailable, setIsAppInBeta, updateApp};
22 changes: 22 additions & 0 deletions src/libs/actions/UpdateRequired.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import Onyx from 'react-native-onyx';
import ONYXKEYS from '@src/ONYXKEYS';
import getEnvironment from '@libs/Environment/getEnvironment';
import CONST from '@src/CONST';

function alertUser() {
// For now, we will pretty much never have to do this on a platform other than production.
// We should only update the minimum app version in the API after all platforms of a new version have been deployed to PRODUCTION.
// As staging is always ahead of production there is no reason to "force update" those apps.
getEnvironment().then((environment) => {
if (environment !== CONST.ENVIRONMENT.PRODUCTION) {
return;
}

Onyx.set(ONYXKEYS.UPDATE_REQUIRED, true);
});
}

export {
// eslint-disable-next-line import/prefer-default-export
alertUser
};
25 changes: 0 additions & 25 deletions tests/unit/MigrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,31 +428,6 @@ describe('Migrations', () => {
});
}));

it('Should remove any instances of participants found in a report', () =>
Onyx.multiSet({
[`${ONYXKEYS.COLLECTION.REPORT}1`]: {
reportID: 1,
participants: ['[email protected]'],
participantAccountIDs: [5],
},
})
.then(PersonalDetailsByAccountID)
.then(() => {
expect(LogSpy).toHaveBeenCalledWith('[Migrate Onyx] PersonalDetailsByAccountID migration: removing participants from report 1');
const connectionID = Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (allReports) => {
Onyx.disconnect(connectionID);
const expectedReport = {
reportID: 1,
participantAccountIDs: [5],
};
expect(allReports[`${ONYXKEYS.COLLECTION.REPORT}1`]).toMatchObject(expectedReport);
},
});
}));

it('Should remove any instances of ownerEmail found in a report', () =>
Onyx.multiSet({
[`${ONYXKEYS.COLLECTION.REPORT}1`]: {
Expand Down

0 comments on commit 450328c

Please sign in to comment.