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

Commit

Permalink
unhandled async in dryrun test (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
josheverett authored Oct 15, 2021
1 parent fc426d2 commit b3bb16c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
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')]);
};

0 comments on commit b3bb16c

Please sign in to comment.