vendredi 23 février 2018

Test namespace in mocha

Hi im trying to test if a namespace exist but everytime im geting a Reference error and dont know why is this happening

This is the test :

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);
  })
});

And This is The JS

function gaApi() {
     //code
}
var PCC = PCC || {};
PCC.gaApi = gaApi;

Thanks

Aucun commentaire:

Enregistrer un commentaire