Skip to content

A fluent assertions library for the Alsatian xUnit testing framework.

License

Notifications You must be signed in to change notification settings

ossplz/alsatian-fluent-assertions

Repository files navigation

MIT License npm version Build Status Windows Build status dependencies Status devDependencies Status codecov Maintainability Known Vulnerabilities PRs Welcome Code of Conduct

Alsatian fluent assertions plugin

This is a fluent assertions plugin for the Alsatian xUnit framework, for JavaScript and TypeScript. It provides a way to chain assertions while narrowing the scope, enabling the clear and concise expression of code specifications for those who prefer a fluent style. By contrast, the default expectations framework in Alsatian is not currently fluent.

Assert(obj)
  .is(UserModel)
  .has(o => o.name)
  .that.hasMatch(/\d+/) // alt 'matches' that returns match result scope
  .that.converted(parts => +parts[0])
  .equals(7);

Assert(obj).equals(expected);

Assert(obj)
  .hasAsserts({ // same as .has/.hasProperties with MatchMode.Asserts
    name: "agent 007",
    address: a => a.is(Redacted),
    phone: /\+44\d{10}/,
    deploy: a => a.is(Function).not.throws()
  });

Basic Usage & Documentation

Please visit our wiki.

Installation

If you already have Alsatian installed, just save this with your devDependencies.

npm i -sD alsatian-fluent-assertions

About

A fluent assertions library for the Alsatian xUnit testing framework.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published