Skip to content

Commit

Permalink
Merge pull request #28894 from margelo/@chrispader/bump-onyx-to-1-0-95
Browse files Browse the repository at this point in the history
Bump Onyx to 1.0.100
  • Loading branch information
marcaaron authored Oct 13, 2023
2 parents d14e998 + c64ee25 commit 3e5f300
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 37 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
"react-native-linear-gradient": "^2.8.1",
"react-native-localize": "^2.2.6",
"react-native-modal": "^13.0.0",
"react-native-onyx": "1.0.98",
"react-native-onyx": "1.0.100",
"react-native-pager-view": "^6.2.0",
"react-native-pdf": "^6.7.1",
"react-native-performance": "^5.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/libs/EmojiUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ function suggestEmojis(text, lang, limit = CONST.AUTO_COMPLETE_SUGGESTER.MAX_AMO
* @returns {Number}
*/
const getPreferredSkinToneIndex = (val) => {
if (!_.isNull(val) && Number.isInteger(Number(val))) {
if (!_.isNull(val) && !_.isUndefined(val) && Number.isInteger(Number(val))) {
return val;
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/sidebar/SidebarLinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function SidebarLinks({onLinkClick, insets, optionListItems, isLoading, priority
const unsubscribeOnyxModal = onyxSubscribe({
key: ONYXKEYS.MODAL,
callback: (modalArg) => {
if (_.isNull(modalArg)) {
if (_.isNull(modalArg) || typeof modalArg !== 'object') {
return;
}
modal.current = modalArg;
Expand Down
14 changes: 7 additions & 7 deletions tests/actions/IOUTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ describe('actions/IOU', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1647,7 +1647,7 @@ describe('actions/IOU', () => {

// Then check the loading state of our action
const resultActionAfterUpdate = reportActions[reportActionID];
expect(resultActionAfterUpdate.pendingAction).toBeNull();
expect(resultActionAfterUpdate.pendingAction).toBeUndefined();

// When we attempt to delete a money request from the IOU report
fetch.pause();
Expand Down Expand Up @@ -1818,7 +1818,7 @@ describe('actions/IOU', () => {
// Then the report should have 2 actions
expect(_.size(reportActions)).toBe(2);
const resultActionAfter = reportActions[reportActionID];
expect(resultActionAfter.pendingAction).toBeNull();
expect(resultActionAfter.pendingAction).toBeUndefined();

fetch.pause();
// When deleting money request
Expand Down Expand Up @@ -1903,7 +1903,7 @@ describe('actions/IOU', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1913,7 +1913,7 @@ describe('actions/IOU', () => {
let resultActionAfterUpdate = reportActions[reportActionID];

// Verify that our action is no longer in the loading state
expect(resultActionAfterUpdate.pendingAction).toBeNull();
expect(resultActionAfterUpdate.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1935,7 +1935,7 @@ describe('actions/IOU', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

await waitForBatchedUpdates();

Expand All @@ -1945,7 +1945,7 @@ describe('actions/IOU', () => {
resultActionAfterUpdate = reportActions[reportActionID];

// Verify that our action is no longer in the loading state
expect(resultActionAfterUpdate.pendingAction).toBeNull();
expect(resultActionAfterUpdate.pendingAction).toBeUndefined();

fetch.pause();
// When we delete the money request
Expand Down
10 changes: 5 additions & 5 deletions tests/actions/ReportTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ describe('actions/Report', () => {

expect(resultAction.message).toEqual(REPORT_ACTION.message);
expect(resultAction.person).toEqual(REPORT_ACTION.person);
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();

// We subscribed to the Pusher channel above and now we need to simulate a reportComment action
// Pusher event so we can verify that action was handled correctly and merged into the reportActions.
Expand Down Expand Up @@ -130,7 +130,7 @@ describe('actions/Report', () => {
const resultAction = reportActions[reportActionID];

// Verify that our action is no longer in the loading state
expect(resultAction.pendingAction).toBeNull();
expect(resultAction.pendingAction).toBeUndefined();
});
});

Expand Down Expand Up @@ -608,7 +608,7 @@ describe('actions/Report', () => {
// Expect the reaction to have null where the users reaction used to be
expect(reportActionsReactions).toHaveProperty(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`);
const reportActionReaction = reportActionsReactions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`];
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeNull();
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeUndefined();
})
.then(() => {
reportAction = _.first(_.values(reportActions));
Expand Down Expand Up @@ -650,7 +650,7 @@ describe('actions/Report', () => {
// Expect the reaction to have null where the users reaction used to be
expect(reportActionsReactions).toHaveProperty(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`);
const reportActionReaction = reportActionsReactions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${reportActionID}`];
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeNull();
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeUndefined();
});
});
});
Expand Down Expand Up @@ -717,7 +717,7 @@ describe('actions/Report', () => {
// Expect the reaction to have null where the users reaction used to be
expect(reportActionsReactions).toHaveProperty(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${resultAction.reportActionID}`);
const reportActionReaction = reportActionsReactions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS_REACTIONS}${resultAction.reportActionID}`];
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeNull();
expect(reportActionReaction[EMOJI.name].users[TEST_USER_ACCOUNT_ID]).toBeUndefined();
});
});
});
24 changes: 9 additions & 15 deletions tests/unit/MigrationTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,12 @@ describe('Migrations', () => {
})
.then(PersonalDetailsByAccountID)
.then(() => {
expect(LogSpy).toHaveBeenCalledWith(
`[Migrate Onyx] Skipped migration PersonalDetailsByAccountID for ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1 because there were no reportActions`,
);
expect(LogSpy).toHaveBeenCalledWith(
`[Migrate Onyx] Skipped migration PersonalDetailsByAccountID for ${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2 because there were no reportActions`,
);
const connectionID = Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (allReportActions) => {
Onyx.disconnect(connectionID);
_.each(allReportActions, (reportActionsForReport) => expect(reportActionsForReport).toBeNull());
_.each(allReportActions, (reportActionsForReport) => expect(reportActionsForReport).toBeUndefined());
},
});
}));
Expand Down Expand Up @@ -377,8 +371,8 @@ describe('Migrations', () => {
waitForCollectionCallback: true,
callback: (allPolicyMemberLists) => {
Onyx.disconnect(connectionID);
expect(allPolicyMemberLists[`${ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}1`]).toBeNull();
expect(allPolicyMemberLists[`${ONYXKEYS.COLLECTION.DEPRECATED_POLICY_MEMBER_LIST}2`]).toBeNull();

expect(allPolicyMemberLists).toBeFalsy();
},
});
}));
Expand Down Expand Up @@ -554,8 +548,8 @@ describe('Migrations', () => {
Onyx.disconnect(connectionID);
const expectedReportAction = {};
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toMatchObject(expectedReportAction);
},
});
Expand Down Expand Up @@ -597,8 +591,8 @@ describe('Migrations', () => {
},
};
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toMatchObject(expectedReportAction1);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toMatchObject(expectedReportAction4);
},
});
Expand All @@ -620,10 +614,10 @@ describe('Migrations', () => {
callback: (allReportActions) => {
Onyx.disconnect(connectionID);
const expectedReportAction = {};
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}1`]).toBeUndefined();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}3`]).toMatchObject(expectedReportAction);
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toBeNull();
expect(allReportActions[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}4`]).toBeUndefined();
},
});
}));
Expand Down

0 comments on commit 3e5f300

Please sign in to comment.