我來教教你前端自動化單元測試如何做(7)

發表于:2016-09-22來源:segmentfault作者:acrens點擊數: 標簽:前端
() { var result = []; result.push( typeof null ); result.push( null instanceof Object ); return result;} /** - 檢測操作符優先級 - @return {[string]} [返回字符串] */ function checkOperator
() { var result = []; result.push(typeof null); result.push(null instanceof Object); return result; } /** - 檢測操作符優先級 - @return {[string]} [返回字符串] */ function checkOperators() { var result = 'autoTest'; result = 'Value is ' + (result === 'autoTest') ? 'Something' : 'Nothing'; return result; }
  • fqa.spec.js 測試代碼

/**
 - test index.js checkMap method
 - detail:
 -     parseInt(val, base), base is 2 ~ 36, otherwise value equal NaN.
 */
describe('test map and callback parseInt', function() {
    
    it('a array call map', function() {
        var nums = checkMap();
        console.log(nums);

        expect([1, NaN, NaN]).toEqual(nums);
    });
});

/**
 - test index.js typeofAndInstanceOf method
 - detail:
 -     typeof null qeual 'object', but null instanceof Object equal false, because null Constructor not Object.
 */
describe('test null is object', function 



           

原文轉自:https://segmentfault.com/a/1190000006969924

国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97