Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hyzhak/to-have-property
toHaveProperty matcher for Jasmine (http://jasmine.github.io/)
https://github.com/hyzhak/to-have-property
Last synced: about 21 hours ago
JSON representation
toHaveProperty matcher for Jasmine (http://jasmine.github.io/)
- Host: GitHub
- URL: https://github.com/hyzhak/to-have-property
- Owner: hyzhak
- License: mit
- Created: 2015-05-13T14:14:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2020-07-15T20:19:26.000Z (over 4 years ago)
- Last Synced: 2024-04-14T14:50:40.163Z (7 months ago)
- Language: JavaScript
- Homepage:
- Size: 11.7 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# toHaveProperty [![npm](https://img.shields.io/npm/v/to-have-property.svg)](https://www.npmjs.com/package/to-have-property) [![Build Status](https://travis-ci.org/hyzhak/to-have-property.svg?branch=master)](https://travis-ci.org/hyzhak/to-have-property)
toHaveProperty matcher for Jasmine (http://jasmine.github.io/) to check whether object has property or not.
## Installation
```
npm install to-have-property --save-dev
```## How to use
```javascript
require('to-have-property');
it('should find property in object', function() {
expect({ x: 10 }).toHaveProperty('x');
});it('should find property in object and check is it equal to certain value', function() {
expect({ y: 123}).toHaveProperty('y', 123);
});it('should find properties in object and check are they equal to values', function() {
expect({ x: 1, y: 2, z: 3}).toHaveProperties({'x': 1, 'y': 2});
});it('should find all properties in object', function() {
expect({ x: 1, y: 2, z: 3 }).toHaveProperties('x', 'y');
});```
## More
[others Jasmine matchers and extensions](http://hyzhak.github.io/jasmine-extensions/)