console.uts 991 字节
Newer Older
杜庆泉's avatar
杜庆泉 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import { describe, test, expect, expectNumber, Result } from './tests.uts'

function obtainInnerObject(obj:Any | null):UTSJSONObject{
  let jsonStr = console.getLogV2(obj).slice(19,-17)
  let a = JSON.parseArray(jsonStr)![0]
  return a as UTSJSONObject
}

export function testConsole() : Result {
  return describe("log", () => {
    test('log-native-obj', () => {
      // #ifdef APP-ANDROID
        expect(obtainInnerObject(0.9).get("type")).toEqual("Double");
        expect(obtainInnerObject(0.9).get("subType")).toEqual("number");
        expect(obtainInnerObject(0.9).get("value")).toEqual("0.9");
杜庆泉's avatar
杜庆泉 已提交
16 17 18 19 20 21 22
        
      // #endif
      
      // #ifdef UNI-APP-X && APP-ANDROID
        let pageInstance = new io.dcloud.uniapp.vue.ComponentInternalInstance()
        expect(obtainInnerObject(pageInstance).get("className")).toEqual("io.dcloud.uniapp.vue.ComponentInternalInstance");
        expect(obtainInnerObject(pageInstance).get("type")).toEqual("object");
杜庆泉's avatar
杜庆泉 已提交
23 24 25 26 27
      // #endif
    }
	)
  })
}