react-native-navigation的迁移库

env.test.js 788B

123456789101112131415161718192021222324252627282930
  1. const _ = require('lodash');
  2. describe('testing that the environment is working properly', () => {
  3. it('object spread', () => {
  4. const { x, y, ...z } = { x: 1, y: 2, a: 3, b: 4 };
  5. expect(x).toEqual(1);
  6. expect(y).toEqual(2);
  7. expect(z).toEqual({ a: 3, b: 4 });
  8. });
  9. it('async await', async () => {
  10. const result = await new Promise((r) => r('hello'));
  11. expect(result).toEqual('hello');
  12. });
  13. it('equality tests', () => {
  14. expect(_.eq('hello', 'hello')).toBe(true);
  15. expect(_.isEqual('hello', 'hello')).toBe(true);
  16. expect(_.eq('hello', Object('hello'))).toBe(false);
  17. expect(_.isEqual('hello', Object('hello'))).toBe(true);
  18. const a = {};
  19. const b = {};
  20. expect(_.eq(a, b)).toBe(false);
  21. expect(_.isEqual(a, b)).toBe(true);
  22. });
  23. });