react-native-navigation的迁移库

remx-support.test.js 923B

123456789101112131415161718192021222324252627282930
  1. xdescribe('remx support', () => {
  2. let React;
  3. let renderer;
  4. let MyConnectedScreen;
  5. let store;
  6. beforeEach(() => {
  7. require('react-native');
  8. React = require('react');
  9. renderer = require('react-test-renderer');
  10. MyConnectedScreen = require('./remx-support-component').default;
  11. store = require('./remx-support-store');
  12. });
  13. it('renders normally', () => {
  14. const tree = renderer.create(<MyConnectedScreen/>);
  15. expect(tree.toJSON().children).toEqual(['no name']);
  16. });
  17. it('rerenders as a result of an underlying state change (by selector)', () => {
  18. const tree = renderer.create(<MyConnectedScreen/>);
  19. const instance = tree.getInstance();
  20. expect(tree.toJSON().children).toEqual(['no name']);
  21. expect(instance.renders).toEqual(1);
  22. store.mutators.setName('Bob');
  23. expect(tree.toJSON().children).toEqual(['no name']);
  24. expect(instance.renders).toEqual(2);
  25. });
  26. });