Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

unhandled async in dryrun test #47

Merged
merged 1 commit into from
Oct 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 3 additions & 0 deletions tests/openTimeoutDryrun/v0.1__second.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports.migrate = async ({firestore}) => {
Promise.all([firestore.collection('data').doc('one').update('key', 'value2')]);
};