Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Where is done and assert from? #13

Open
alanjames1987 opened this issue Nov 8, 2015 · 1 comment
Open

Where is done and assert from? #13

alanjames1987 opened this issue Nov 8, 2015 · 1 comment

Comments

@alanjames1987
Copy link

In the documentation under "Usage" where is done and assert coming from?

var phantom = require('x-ray-phantom');
var Xray = require('x-ray');

var x = Xray()
  .driver(phantom());

x('http://google.com', 'title')(function(err, str) {
  if (err) return done(err); // <----------- where is this defined?
  assert.equal('Google', str); // <----------- where is this defined?
  done(); // <----------- where is this defined?
})

I assume they are coming from a user defined assertion library, but I feel like that should be made more clear.

@alanjames1987 alanjames1987 changed the title Where is done from? Where is done and assert from? Nov 8, 2015
@Koleok
Copy link

Koleok commented May 21, 2016

I think the implication is that this would live in a mocha/jasmine test, so this example would be much more clear as

var assert = require('assert');
var phantom = require('x-ray-phantom');
var Xray = require('x-ray');

var x = Xray().driver(phantom());

describe('this should work', () => {
  it('should get the title from google', done => {
    x('http://google.com', 'title')(function(err, str) {
      if (err) return done(err);

      assert.equal('Google', str);
      done();
    });
  });
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants