mirror of https://github.com/status-im/metro.git
Unit test reloading when hot loading is enabled
Reviewed By: sahrens Differential Revision: D2824276 fb-gh-sync-id: a81acd20eb5b7d3da61becac00e4bdbea6b61a2f
This commit is contained in:
parent
da3838f6ca
commit
18e5e50e11
|
@ -165,6 +165,18 @@ describe('processRequest', () => {
|
|||
});
|
||||
|
||||
it('rebuilds the bundles that contain a file when that file is changed', () => {
|
||||
testChangingFileWith(() => new Server(options));
|
||||
});
|
||||
|
||||
it('rebuilds the bundles that contain a file when that file is changed, even when hot loading is enabled', () => {
|
||||
testChangingFileWith(() => {
|
||||
const server = new Server(options);
|
||||
server.setHMRFileChangeListener(() => Promise.resolve());
|
||||
return server;
|
||||
});
|
||||
});
|
||||
|
||||
function testChangingFileWith(createServer) {
|
||||
const bundleFunc = jest.genMockFunction();
|
||||
bundleFunc
|
||||
.mockReturnValueOnce(
|
||||
|
@ -182,7 +194,7 @@ describe('processRequest', () => {
|
|||
|
||||
Bundler.prototype.bundle = bundleFunc;
|
||||
|
||||
server = new Server(options);
|
||||
server = createServer();
|
||||
|
||||
requestHandler = server.processRequest.bind(server);
|
||||
|
||||
|
@ -205,7 +217,7 @@ describe('processRequest', () => {
|
|||
expect(response).toEqual('this is the rebuilt source')
|
||||
);
|
||||
jest.runAllTicks();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
describe('/onchange endpoint', () => {
|
||||
|
|
Loading…
Reference in New Issue