2
0

setup.test.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /**
  2. * mini-testing-utils setup文件测试
  3. * 验证Taro组件mock和浏览器API mock是否正确配置
  4. */
  5. import '@testing-library/jest-dom'
  6. // 这个测试文件验证setup.ts是否正确导入和执行
  7. describe('mini-testing-utils setup', () => {
  8. it('should have Taro environment variables set', () => {
  9. expect(process.env.TARO_ENV).toBe('h5')
  10. expect(process.env.TARO_PLATFORM).toBe('web')
  11. })
  12. it('should have defineAppConfig global function', () => {
  13. expect(typeof (global as any).defineAppConfig).toBe('function')
  14. })
  15. it('should have MutationObserver mock', () => {
  16. expect(typeof global.MutationObserver).toBe('function')
  17. })
  18. it('should have IntersectionObserver mock', () => {
  19. expect(typeof global.IntersectionObserver).toBe('function')
  20. })
  21. it('should have ResizeObserver mock', () => {
  22. expect(typeof global.ResizeObserver).toBe('function')
  23. })
  24. it('should have matchMedia mock', () => {
  25. expect(typeof window.matchMedia).toBe('function')
  26. })
  27. it('should have getComputedStyle mock', () => {
  28. expect(typeof window.getComputedStyle).toBe('function')
  29. })
  30. it('should have getBoundingClientRect mock', () => {
  31. expect(typeof Element.prototype.getBoundingClientRect).toBe('function')
  32. })
  33. })