Giter Club home page Giter Club logo

chai-fuzzy's People

Contributors

bartvds avatar elliotf avatar jonknapp avatar keithamus avatar remojansen avatar robcolburn avatar rubenverborgh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

chai-fuzzy's Issues

jsonOf/like with custom objects

Test case:

var chai = require('chai');
chai.use(require('chai-fuzzy'));
var expect = chai.expect();

function Document() {}
var actual = new Document();
actual.foo = 1;
actual.bar = 2;
var expected = { foo: 1, bar: 2};
expect(actual).to.be.jsonOf(expected);

Expected: no error.

Actual:

      AssertionError: expected { Object (foo, bar, ...) } to be like JSON { Object (foo, bar, ...) }
      + expected - actual

Is this a bug? Is there a way to lossy compare just provided keys?

how is this different from deep.equal ?

I had thought that this would be possible:

expect({ key1:0, key2:1 }).to.be.like({ key1:0 });

but it just seems to perform like deep.equal(), which is already provided by Mocha. I'm confused.


Edit: the functionality that I'd expected above in my code sample is made possible with chai-like.

Cannot find module 'underscore'

underscore is not listed on the dependencies of chai-fuzzy, only on devDependencies, so it fails unless underscore is added as a dependency of the parent project.

Fails when used with require.js and Mocha

The current code for checking if the plugin is running in a browser or server-side only checks the types of a few different properties that are available in an application that uses require.js.

if (
  typeof require === "function"
  && typeof exports === "object"
  && typeof module === "object"
) {
  // server-side
  _ = require('underscore');
} else {
  // browser-side
  _ = window._;
}

It might be better to check for the existence of the "_" property on window first, then fall back to saying it's running on the server.

My setup could be a bit different than others as well, so please let me know if you need more information.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.