alsatian-fluent-assertions
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.0-beta.5 • Public • Published

    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

    Install

    npm i alsatian-fluent-assertions

    DownloadsWeekly Downloads

    9

    Version

    1.0.0-beta.5

    License

    MIT

    Unpacked Size

    107 kB

    Total Files

    91

    Last publish

    Collaborators

    • cdibbs