From 6bb4c8045008624a008a823bca1b99cdf736db4e Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Sun, 11 Nov 2018 11:12:41 -0800 Subject: [PATCH] chore(tests): avoid delaying when inserting every post in tests (#625) --- bin/restore-mastodon-data.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/restore-mastodon-data.js b/bin/restore-mastodon-data.js index 42028ac..0078661 100644 --- a/bin/restore-mastodon-data.js +++ b/bin/restore-mastodon-data.js @@ -45,7 +45,11 @@ export async function restoreMastodonData () { console.log('Restoring mastodon data...') let internalIdsToIds = {} for (let action of actions) { - await new Promise(resolve => setTimeout(resolve, 1000)) // delay so that notifications have proper order + if (!action.post) { + // If the action is a boost, favorite, etc., then it needs to + // be delayed, otherwise it may appear in an unpredictable order and break the tests. + await new Promise(resolve => setTimeout(resolve, 1000)) + } console.log(JSON.stringify(action)) let accessToken = users[action.user].accessToken