react-native-navigation的迁移库

PropsStore.test.js 603B

1234567891011121314151617181920212223
  1. describe('PropsStore', () => {
  2. let uut;
  3. beforeEach(() => {
  4. uut = require('./PropsStore');
  5. });
  6. it('initial state', () => {
  7. expect(uut.getPropsForScreenId('screen1')).toEqual({});
  8. });
  9. it('holds props by screenId', () => {
  10. uut.setPropsForScreenId('screen1', {a: 1, b: 2});
  11. expect(uut.getPropsForScreenId('screen1')).toEqual({a: 1, b: 2});
  12. });
  13. it('defensive for invalid screenId and props', () => {
  14. uut.setPropsForScreenId('screen1', undefined);
  15. uut.setPropsForScreenId(undefined, undefined);
  16. expect(uut.getPropsForScreenId('screen1')).toEqual({});
  17. });
  18. });