react-native-navigation的迁移库

Commands.test.js 585B

12345678910111213141516171819202122232425
  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. jest.mock('../providers/UniqueIdProvider');
  10. uut = require('./Commands');
  11. });
  12. describe('startApp', () => {
  13. it('sends startApp to native', () => {
  14. uut.startApp({
  15. container: {
  16. key: 'com.example.MyScreen'
  17. }
  18. });
  19. expect(mockNativeNavigation.startApp).toHaveBeenCalledTimes(1);
  20. });
  21. });
  22. });