react-native-navigation的迁移库

Commands.test.js 537B

123456789101112131415161718192021222324
  1. describe('Commands', () => {
  2. let uut;
  3. let mockNativeNavigation;
  4. beforeEach(() => {
  5. mockNativeNavigation = {
  6. startApp: jest.fn()
  7. };
  8. require('react-native').NativeModules.NativeNavigation = mockNativeNavigation;
  9. uut = require('./Commands');
  10. });
  11. describe('startApp', () => {
  12. it('sends startApp to native', () => {
  13. uut.startApp({
  14. container: {
  15. key: 'com.example.MyScreen'
  16. }
  17. });
  18. expect(mockNativeNavigation.startApp).toHaveBeenCalledTimes(1);
  19. });
  20. });
  21. });