How to use the chai.should function in chai

To help you get started, we’ve selected a few chai examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github GoogleChromeLabs / sw-toolbox / test / automated-suite.js View on Github external
'use strict';

/* eslint-disable max-len, no-console, padded-blocks, no-multiple-empty-lines */
/* eslint-env node,mocha */

// These tests make use of selenium-webdriver. You can find the relevant
// documentation here: https://github.com/SeleniumHQ/selenium

const path = require('path');
const seleniumAssistant = require('selenium-assistant');
const mochaUtils = require('sw-testing-helpers').mochaUtils;

require('geckodriver');
require('chromedriver');

require('chai').should();

const testServer = require('./server/index.js');

describe('Test SW-Toolbox', function() {
  // Browser tests can be slow
  this.timeout(100000);

  // Selenium Tests are Flakey
  this.retries(3);

  // Driver is initialised to `null` to handle scenarios
  // where the desired browser isn't installed / fails to load
  // `null` allows afterEach a safe way to skip quiting the driver
  let globalDriverReference = null;
  let testServerURL;
github SciCatProject / catamel / test / Users.js View on Github external
/* jshint node:true */
/* jshint esversion:6 */
'use strict';

// process.env.NODE_ENV = 'test';

var chai = require('chai');
var chaiHttp = require('chai-http');
var request = require('supertest');
var utils = require('./LoginUtils');
var should = chai.should();

var accessToken = null;

var app
before( function(){
    app = require('../server/server')
});

describe('Login with functional accounts', () => {

    it('Ingestor login fails with incorrect credentials', function(done) {
        request(app)
            .post('/api/v3/Users/Login?include=user')
            .send({
                'username': 'ingestor',
                'password': 'abc123'
github appium / appium / test / functional / ios / testapp / device-specs.js View on Github external
"use strict";

var _ = require('underscore'),
    initSession = require('../../../helpers/session').initSession,
    should = require('chai').should(),
    expect = require('chai').expect,
    XCODE = require('../../../../lib/future.js').xcode,
    fs = require('fs'),
    env = process.env,
    desired = require('./desired');

require('../../../helpers/setup-chai.js');

describe('testapp - device', function () {

  describe('xcode#getpath', function () {
    it('should always return a valid path', function (done) {
      this.timeout(5000);
      // getPath failures have been intermittent, so try a few times
      var iterations = 100;
      var nextTest = function () {
github chrisveness / geodesy / test / latlon-vectors-tests.js View on Github external
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */
/*  Geodesy Test Harness - latlon-vectors                             (c) Chris Veness 2014-2017  */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  */

'use strict';

require('chai').should();  // BDD/TDD assertion library

var LatLon   = require('../npm.js').LatLonVectors;
var Vector3d = require('../npm.js').Vector3d;
var Dms      = require('../npm.js').Dms;

var test = it; // just an alias

describe('latlon-vectors', function() {
    var R = 6371e3;
    var π = Math.PI;

    describe('formatting', function() {
        test('toString d',       function() { new LatLon(51.521470, -0.138833).toString('d', 6).should.equal('51.521470°N, 000.138833°W'); });
        test('toString dms',     function() { new LatLon(51.521470, -0.138833).toString('dms', 2).should.equal('51°31′17.29″N, 000°08′19.80″W'); });
    });
github AXErunners / axecore-lib / test / mnemonic / mnemonic.unit.js View on Github external
/* eslint-disable */
// TODO: Remove previous line and work through linting issues at next edit

'use strict';

var chai = require('chai');
var should = chai.should();

var Mnemonic = require('../../index').Mnemonic;
var errors = require('../../lib/mnemonic/errors');
var bip39_vectors = require('./data/fixtures.json');

describe('Mnemonic', function() {
  this.timeout(30000);

  it('should initialize the class', function() {
    should.exist(Mnemonic);
  });

  describe('# Mnemonic', function() {

    describe('Constructor', function() {
      it('does not require new keyword', function() {
github cerner / terra-toolkit / src / wdio / services / TerraService.js View on Github external
before(capabilities) {
    /* Add Terra's custom Wdio command for a11y testing. */
    global.browser.addCommand('axe', axeCommand);

    /* Initialize the Chai assertion library to have more expressive tests. */
    chai.config.showDiff = false;
    global.expect = chai.expect;
    global.should = chai.should();

    /* Add Terra's custom Chai assertion helpers for a11y & VR testing. */
    chai.Assertion.addMethod('accessible', chaiMethods.accessible);
    chai.Assertion.addMethod('matchReference', chaiMethods.matchReference);

    /* Add a Terra global with access to Mocha-Chai test helpers. */
    global.Terra = {
      /* `viewports` provides access Terra's list of test viewports. */
      viewports: viewportHelpers.getViewports,

      /* `describeViewports` provides a custom Mocha `describe` block for looping test viewports. */
      describeViewports: viewportHelpers.describeViewports,

      /* `validates` provides access to the chai assertions to use in Mocha `it` blocks. */
      validates: {
        accessibility: accessibility.validatesAccessibility,
github dashedstripes / zendesk-node-api / test / models / ticketfields.js View on Github external
var should = require('chai').should();
var expect = require('chai').expect;

module.exports = function(zendesk){
  var TICKET_FIELD_ID = require('./config.js').TICKET_FIELD_ID;

  it('should get all ticket fields', function(done){
    this.timeout(20000);
    zendesk.ticketFields.list().then(function(ticketFields){
      expect(ticketFields).to.exist;
      done();
    }).catch(function(err){
      done(err);
    });
  });

  it('should show a ticket field by id', function(done){
github grasshopper-cms / grasshopper-api-js / test / page-not-found.js View on Github external
'use strict';
var request = require('supertest'),
    exec = require('child_process').execSync,
    url = require('./config/test').url,
    start = require('./_start');

require('chai').should();

describe('page not found', function(){

    before(function(done){
        exec('./tasks/importdb.sh');
        this.timeout(10000);
        start()
            .then(function(){
                done();
            });
    });

    it('should return a 404 for a non existent endpoint', function(done) {
        request(url)
            .get('/something-made-up')
            .set('Accept', 'application/json')
github ngageoint / geopackage-js / test / lib / core / srs / testSpatialReferenceSystem.js View on Github external
var GeoPackageAPI = require('../../../..')
  , SpatialReferenceSystemDao = require('../../../../lib/core/srs').SpatialReferenceSystemDao
  , SpatialReferenceSystem = require('../../../../lib/core/srs').SpatialReferenceSystem
  , should = require('chai').should()
  , path = require('path');

describe('SpatialReferenceSystem tests', function() {

  var geoPackage;

  beforeEach('should open the geopackage', function(done) {
    var filename = path.join(__dirname, '..', '..', '..', 'fixtures', 'gdal_sample.gpkg');
    GeoPackageAPI.open(filename, function(err, gp) {
      geoPackage = gp;
      should.not.exist(err);
      should.exist(gp);
      should.exist(gp.getDatabase().getDBConnection());
      gp.getPath().should.be.equal(filename);
      done();
    });
github hfreire / facebook-login-for-robots / test / mocha.js View on Github external
const _ = require('lodash')
const Promise = require('bluebird')

const chai = require('chai')
chai.use(require('chai-as-promised'))
chai.config.includeStack = true

const td = require('testdouble')
td.config({
  promiseConstructor: Promise,
  ignoreWarnings: true
})

global._ = _
global.Promise = Promise
global.should = chai.should()
global.td = td