From b3bb16cba6d7170346493dd5e3c40a033f80351a Mon Sep 17 00:00:00 2001 From: Josh Everett Date: Fri, 15 Oct 2021 15:53:07 -0700 Subject: [PATCH] unhandled async in dryrun test (#47) --- tests/index.js | 25 +++++++++++++++++++++++++ tests/openTimeoutDryrun/v0.1__second.js | 3 +++ 2 files changed, 28 insertions(+) create mode 100644 tests/openTimeoutDryrun/v0.1__second.js diff --git a/tests/index.js b/tests/index.js index 3d9dd11..4227603 100644 --- a/tests/index.js +++ b/tests/index.js @@ -360,6 +360,31 @@ test('async: handle unhandled async error', wrapper(async ({t, projectId, firest } })); +test('async: unhandled async in dryrun', wrapper(async ({t, projectId, firestore, app}) => { + await fireway.migrate({ + projectId, + path: __dirname + '/oneMigration', + app + }); + + await fireway.migrate({ + dryrun: true, + projectId, + path: __dirname + '/openTimeoutDryrun', + app + }); + + const snapshot = await firestore.collection('fireway').get(); + const dataSnapshot = await firestore.collection('data').get(); + const [doc1] = dataSnapshot.docs; + t.equal(snapshot.size, 1); + t.deepEqual(doc1.data(), {key: 'value'}); + t.equal( + terminal.includes('WARNING: fireway detected open async calls'), + true + ); +})); + test('Delete a field', wrapper(async ({t, projectId, firestore, app}) => { await firestore.collection('data').doc('doc').set({ field1: 'field1', diff --git a/tests/openTimeoutDryrun/v0.1__second.js b/tests/openTimeoutDryrun/v0.1__second.js new file mode 100644 index 0000000..2821a81 --- /dev/null +++ b/tests/openTimeoutDryrun/v0.1__second.js @@ -0,0 +1,3 @@ +module.exports.migrate = async ({firestore}) => { + Promise.all([firestore.collection('data').doc('one').update('key', 'value2')]); +};