How to use the expect.js.eql function in expect

To help you get started, we’ve selected a few expect 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 shapesecurity / shift-parser-js / test / test262-parser-tests / errors.js View on Github external
test(`does not throw error and generates same tree[${f}]`, () => {
        let passSrc = fs.readFileSync(passTestFile, 'utf8');
        let passTree, passLocations, passComments;
        expect(() => {
          ({ tree: passTree, locations: passLocations, comments: passComments } = parse(passSrc, isModule(f), true));
        }).to.not.throwError();
        locationSanityCheck(passTree, passLocations);

        let passExplicitSrc = fs.readFileSync(passExplicitTestFile, 'utf8');
        let passExplicitTree;
        expect(() => {
          passExplicitTree = parse(passExplicitSrc, isModule(f), true).tree;
        }).to.not.throwError();

        expect.eql(passTree, passExplicitTree);

        let treeExpectation = JSON.parse(fs.readFileSync(expectationsDir + '/' + f + '-tree.json', 'utf8'));
        expect(decorateWithLocations(passTree, passLocations)).to.eql(treeExpectation);

        let commentExpectation = JSON.parse(fs.readFileSync(expectationsDir + '/' + f + '-comments.json', 'utf8'));
        expect(passComments).to.eql(commentExpectation);
      });
    }
github regularjs / regular / test / spec / test-lexer.js View on Github external
ao.typeEqual = function(list){
  if(typeof list == 'string') list = list.split(',')
  var types = this.obj.map(function(item){
    return item.type
  });
  this.assert(
      expect.eql(types, list) 
    , function(){ return 'expected ' + list + ' to equal ' + types }
    , function(){ return 'expected ' + list + ' to not equal ' + types });
  return this;
}
github shapesecurity / shift-parser-js / test / api / api.js View on Github external
function parseModule(name) {
    let source = require('fs').readFileSync(require.resolve(name), 'utf-8');
    let tree = ShiftParser.parseModule(source, { earlyErrors: true });
    let tree2 = ShiftParser.parseModule(source, { earlyErrors: false });
    expect.eql(tree, tree2);
  }
github shapesecurity / shift-parser-js / test / api / api.js View on Github external
function parseScript(name) {
    let source = require('fs').readFileSync(require.resolve(name), 'utf-8');
    let tree = ShiftParser.parseScript(source, { earlyErrors: true });
    let tree2 = ShiftParser.parseScript(source, { earlyErrors: false });
    expect.eql(tree, tree2);
  }

expect

This package exports the `expect` function used in [Jest](https://jestjs.io/). You can find its documentation [on Jest's website](https://jestjs.io/docs/expect).

MIT
Latest version published 8 months ago

Package Health Score

93 / 100
Full package analysis