GithubHelp home page GithubHelp logo

fluent-assert's People

Contributors

zack37 avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

gitter-badger

fluent-assert's Issues

Convention Cleanup

Need to:

  • Cleanup all of the test it messages to all be in the should language style.
  • Add .npmignore to exclude tests and coverage reporting. Update package.json to only include the few things necessary. Shorter ๐Ÿ˜ƒ
  • Update all jsdoc
  • Add a CONTRIBUTING.md to document coding styles and standards
  • Cleanup README.md
  • Fix CI and coverage tasks to be separate and run lint on CI. Along with this, remove the need for global mocha and istanbul
  • Refactor assert classes to use an assert base class.
  • Beef up .editorconfig and .eslintrc
  • Add more tests, specifically for ensuring return values since it's bitten me in the butt before.

More could come up as the prior issues are being completed. Will add more as they come up

.optional asserts with tag along assertions throw

For example:

someFunc(thing){
  assert.optional().array('thing.arr', thing.arr).of('object');
}

will throw an exception when it gets to .of('object') if thing.arr is undefined or null

I would assume/prefer if the tag on assertions just passed if the optional parent was omitted.

I have not tested the other assertions for this (such as assert.optional().string(...).notWhitespace()), but would assume the behavior is the same currently.

Add date assertions

assert.date()
Need to add date assertions

  • Before a date
  • After a date
  • Within date range
  • Month of
  • Date of
  • Year of

Assert.ok('value', object) returns undefined

The message passed in assert.ok is returning undefined for the context.

assert.ok('something', object);

Reports undefined instead of something in the error message

AssertionError: expected [Function] to throw error matching /object/ but got 'AssertionError: undefined + \'should not be undefined or null'

Production mode

Need to add NODE_NDEBUG flag for making sure assertions don't affect performance and can be turned off for production. Decided to use NODE_ENV instead and turn off typeof checks for NODE_ENV=production
For simplicity, the production flag is only going to wrap typeof checks and return true when in production mode to still get validation on type properties.

Asserting not undefined but allows nulls

Ran into a use case where null is allowed but I don't want undefined.

In this use case null was going to be used as a SQL value.

var isUndefined = metadata.value === undefined ? undefined : 1;
assert.ok('value', isUndefined);

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.