Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-spec-chai

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-spec-chai - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

1

dist/extensions.d.ts

@@ -30,3 +30,2 @@ /**

conform(spec: object): void;
addMethod(name: string, fn: (value: any) => void): void;
}

@@ -33,0 +32,0 @@ }

2

package.json
{
"name": "js-spec-chai",
"version": "0.1.0",
"version": "0.1.1",
"description": "Chai plugin for js.spec",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

# js-spec-chai
Chai plugin for js.spec
### Usage
The only addition to `Chai.Assertion` is the `conform` method with accepts the `Spec` object to test against.
Examples can be found in `test/index.test.ts`, but the gist of it is show below:
```
import * as s from "js.spec"
import * as chai from "chai";
import jsSpecChai from "../src/index";
// fancy chai dancing
chai.use(jsSpecChai);
chai.should();
describe("js-spec-chai", () => {
context("with nested maps", () => {
const school = s.spec.map("schoolSpec", {
city: s.string
});
const friend = s.spec.map("friendSpec", {
name: s.spec.string,
age: s.spec.number,
school
});
it("conforms a good object", () => {
const obj = {
name: "andrea",
age: 18,
school: {
city: "Turin",
}
};
obj.should.conform(friend);
})
it("does not conform is there is a missing key", () => {
const obj = {
name: "andrea",
school: {
city: "Turin",
}
};
obj.should.not.conform(friend);
});
});
});
```
#### License

@@ -5,0 +55,0 @@

@@ -35,3 +35,2 @@ // Type definitions for [js-spec-chai] [0.1.0]

conform(spec: object): void;
addMethod(name: string, fn: (value: any) => void): void;
}

@@ -38,0 +37,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc