Zombie.js - Test if object property found

96 Views Asked by At

Im a bit new of Zombie.js testing, and hard to search so I will ask here ...

Example : (Globla variable)

hello = {"world" : "...."}

So I test something like :

describe('Check varibles', function() {
    it('If ---> hello <--- exits', function(done) {
        browser.assert.global('hello');
        done();
    });

    it('If ---> hello.world <--- exits', function(done) {
        // ????
        done();
    });
});

I can check if hello is exits. But how to check if hello.world` is exits ?

I tried with :

browser.assert.global('hello.world'); // AssertionError: undefined == true 
1

There are 1 best solutions below

0
l2aelba On

Oh I got an alternative (use assert directly)

First : require assert

const assert = require('assert');

So do something like :

it('If ---> hello.world <--- exits', function(done){
   assert.ok(browser.window.hello.world);
   //assert.ok(!browser.window.hello.world); <-- or check if not exits
   done();
});