sse-channel.test.js 676 B

12345678910111213141516171819202122232425262728
  1. const PAGE_PATH = '/pages/API/unicloud/unicloud/sse-channel'
  2. const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
  3. const isMP = platformInfo.startsWith('mp')
  4. const isWeb = platformInfo.startsWith('web')
  5. describe('sse-channel', () => {
  6. beforeAll(async () => {
  7. page = await program.reLaunch(PAGE_PATH)
  8. })
  9. if(!isMP && !isWeb) {
  10. // 需要自定义基座方可使用push
  11. it('skip test', () => {
  12. expect(1).toBe(1)
  13. })
  14. return
  15. }
  16. it('basic', async () => {
  17. await page.callMethod('receiveMessage')
  18. await page.waitFor(5000)
  19. const {
  20. messages
  21. } = await page.data()
  22. expect(messages.length).toBe(2)
  23. })
  24. });