Skip to content

Commit

Permalink
Add integration test for changed file in new directory (facebook/reac…
Browse files Browse the repository at this point in the history
robhogan committed Mar 21, 2023
1 parent 6d65a32 commit 40e33ea
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/metro-file-map/src/watchers/__tests__/integration-test.js
Original file line number Diff line number Diff line change
@@ -206,6 +206,33 @@ describe.each(Object.keys(WATCHERS))(
});
});

maybeTest('detects changes to files in a new directory', async () => {
expect(
await eventHelpers.nextEvent(() => mkdir(join(watchRoot, 'newdir'))),
).toStrictEqual({
path: join('newdir'),
eventType: 'add',
metadata: {
modifiedTime: expect.any(Number),
size: expect.any(Number),
type: 'd',
},
});
expect(
await eventHelpers.nextEvent(() =>
writeFile(join(watchRoot, 'newdir', 'file-in-new-dir.js'), 'code'),
),
).toStrictEqual({
path: join('newdir', 'file-in-new-dir.js'),
eventType: 'add',
metadata: {
modifiedTime: expect.any(Number),
size: expect.any(Number),
type: 'f',
},
});
});

maybeTest(
'emits deletion for all files when a directory is deleted',
async () => {

0 comments on commit 40e33ea

Please sign in to comment.