get-system-setting.test.js 1.0 KB
Newer Older
1 2
const PAGE_PATH = '/pages/API/get-system-setting/get-system-setting'

雪洛's avatar
雪洛 已提交
3 4 5 6 7 8 9
describe('ExtApi-GetSystemSetting', () => {
  if (process.env.uniTestPlatformInfo.indexOf('web') > -1) {
    it('web', () => {
      expect(1).toBe(1)
    })
    return
  }
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

  let page;
  let res;
  beforeAll(async () => {
    page = await program.reLaunch(PAGE_PATH)
    await page.waitFor(600);
    res = await uni.getSystemSetting()
  });
  it('Check GetSystemSetting', async () => {
    for (const key in res) {
      const value = res[key];
      if (res['bluetoothEnabled'] == undefined) {
        expect(res['bluetoothError']).not.toBe("")
      } else {
        expect(res['bluetoothError'] == undefined).toBe(true)
      }

      if (res['wifiEnabled'] == undefined) {
        expect(res['wifiError']).not.toBe("")
      } else {
        expect(res['wifiError'] == undefined).toBe(true)
      }

      if (key == 'deviceOrientation') {
        expect(['portrait', 'landscape']).toContain(value);
      }
    }
  });
});