Skip to content

Commit

Permalink
Add integration test for changed file in new directory (#950)
Browse files Browse the repository at this point in the history
Summary:
Cherry pick the new integration test covering facebook/react-native#36387 from #949

Pull Request resolved: #950

Reviewed By: huntie

Differential Revision: D44254000

Pulled By: robhogan

fbshipit-source-id: 10d202ec153b55e8ecbe282d0b907fabee0fe5b6
  • Loading branch information
robhogan authored and facebook-github-bot committed Mar 21, 2023
1 parent 6d65a32 commit 5caa240
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
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 5caa240

Please sign in to comment.