get-app.test.js 1.0 KB
Newer Older
DCloud-WZF's avatar
DCloud-WZF 已提交
1 2 3
const PAGE_PATH = '/pages/API/get-app/get-app'

describe('getApp', () => {
4 5 6 7 8 9 10
  let page = null
  beforeAll(async () => {
    page = await program.navigateTo(PAGE_PATH)
    await page.waitFor('view')
  })
  it('globalData', async () => {
    await page.callMethod('getGlobalData')
11
    let data = await page.data()
12 13 14
    expect(data.globalDataStr).toBe('global data str')
    expect(data.globalDataNum).toBe(123)
    expect(data.globalDataBool).toBe(true)
15 16 17 18 19 20
    await page.callMethod('setGlobalData')
    await page.callMethod('getGlobalData')
    data = await page.data()
    expect(data.globalDataStr).toBe('new global data str')
    expect(data.globalDataNum).toBe(456)
    expect(data.globalDataBool).toBe(false)
21 22 23
  })
  it('method', async () => {
    const oldLifeCycleNum = await page.data('lifeCycleNum')
DCloud-WZF's avatar
DCloud-WZF 已提交
24
    await page.callMethod('_increasetLifeCycleNum')
25 26 27
    const newLifeCycleNum = await page.data('lifeCycleNum')
    expect(newLifeCycleNum - oldLifeCycleNum).toBe(100)
    await page.callMethod('setLifeCycleNum', oldLifeCycleNum)
DCloud-WZF's avatar
DCloud-WZF 已提交
28 29
  })
})