您好我试图测试命名空间是否存在,但每次我得到一个 参考错误,我不知道为什么会这样。
这是测试:
var test = require('unit.js');
var assert = require('assert');
var gaApiLoaded = require('/home/passh/src/pccfront/src/Pcc/Bundle/WebBundle/Resources/public/raw/js/gaApi/gaApi.js');
describe('Array', function() {
describe('#indexOf()', function() {
it('should return -1 when the value is not present', function() {
assert.equal([1,2,3].indexOf(4), -1);
});
});
});
describe('gaApi', function () {
it('push into Datalayer when new user is created with true', function () {
var gaApi = PCC.gaApi();
assert.equal(1,1);
})
});
这是JS
function gaApi() {
//code
}
var PCC = PCC || {};
PCC.gaApi = gaApi;
感谢。