mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-11 11:29:03 +08:00
Allow UnpackingJSBundleLoader's client to queue action to perform after unpacking
Reviewed By: tadeuzagallo Differential Revision: D3735948 fbshipit-source-id: 5971a5367eb4b5a90e0f23b9279759e9f4060222
This commit is contained in:
committed by
Facebook Github Bot 8
parent
d3238569bf
commit
2618ba2d60
@@ -56,6 +56,8 @@ public class UnpackingJSBundleLoaderTest {
|
||||
private CatalystInstanceImpl mCatalystInstanceImpl;
|
||||
private UnpackingJSBundleLoader.Unpacker[] mMockUnpackers;
|
||||
|
||||
private Runnable mCallback;
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
mDestinationPath = folder.newFolder("destination");
|
||||
@@ -75,6 +77,8 @@ public class UnpackingJSBundleLoaderTest {
|
||||
for (int i = 0; i < mMockUnpackers.length; ++i) {
|
||||
mMockUnpackers[i] = mock(UnpackingJSBundleLoader.Unpacker.class);
|
||||
}
|
||||
|
||||
mCallback = mock(Runnable.class);
|
||||
}
|
||||
|
||||
private void addUnpackers() {
|
||||
@@ -193,4 +197,17 @@ public class UnpackingJSBundleLoaderTest {
|
||||
assertFalse(mDestinationPath.exists());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackIsCalledAfterUnpack() {
|
||||
mBuilder.setOnUnpackedCallback(mCallback).build().prepare();
|
||||
verify(mCallback).run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCallbackIsNotCalledIfNothingIsUnpacked() {
|
||||
mBuilder.build().prepare();
|
||||
mBuilder.setOnUnpackedCallback(mCallback).build().prepare();
|
||||
verifyNoMoreInteractions(mCallback);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user