https://github.com/aswitalski/assert-that
JavaScript assertion library with super-simple syntax
https://github.com/aswitalski/assert-that
assert assertion assertion-library assertions javascript
Last synced: 11 months ago
JSON representation
JavaScript assertion library with super-simple syntax
- Host: GitHub
- URL: https://github.com/aswitalski/assert-that
- Owner: aswitalski
- License: mit
- Created: 2017-04-21T23:35:47.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-04-22T22:50:32.000Z (about 9 years ago)
- Last Synced: 2025-03-09T13:03:54.906Z (over 1 year ago)
- Topics: assert, assertion, assertion-library, assertions, javascript
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# assert-that
JavaScript assertion library with super-simple syntax.
# Syntax
``` js
const node = shallowRender(template);
assert.that(node.firstChild.isElement().hasName('div').hasId());
assert.that(node.lastChild.isComponent(MyComponent).withChild(Element));
assert.that(element.children() > 5);
assert.that(element.children(MyComponent, { label: /Choose/ }) >= 1);
assert.that(component.services() == 3);
assert.that(component.services(OtherService));
assert.that(element.children().find(MyComponent, OtherComponent, 'div'));
assert.that(element.children().filter({ class: 'some-name' }) == 2);
```