react-native-navigation的迁移库

Commands.test.js 929B

123456789101112131415161718192021222324252627282930313233
  1. describe('Commands', () => {
  2. let uut;
  3. beforeEach(() => {
  4. uut = require('./Commands');
  5. });
  6. describe('startApp', () => {
  7. it('receives params object', () => {
  8. uut.startApp({
  9. screenKey: {
  10. screen: 'example.MyScreen'
  11. },
  12. drawer: {
  13. left: {
  14. screen: 'example.SideMenu'
  15. }
  16. }
  17. });
  18. });
  19. it('expects to get screenKey, or tabs with screenKeys', () => {
  20. expect(() => uut.startApp({screenKey: 'example.MyScreen'})).not.toThrow();
  21. expect(() => uut.startApp({tabs: [{screenKey: 'example.Tab1'}]})).not.toThrow();
  22. expect(() => uut.startApp()).toThrow();
  23. expect(() => uut.startApp({})).toThrow();
  24. expect(() => uut.startApp({tabs: []})).toThrow();
  25. expect(() => uut.startApp({tabs: [{}]})).toThrow();
  26. expect(() => uut.startApp({tabs: [{screenKey: 'example.Tab1'}, {}]})).toThrow();
  27. });
  28. });
  29. });