forked from rom3r4/Karma-Read-JSON
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nathan Nelson
committed
Feb 9, 2015
1 parent
2030040
commit 77bf4f3
Showing
3 changed files
with
36 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,30 @@ | ||
# Karma-Read-JSON | ||
Karma helper function to make reading JSON files easier | ||
# Karma-JSON-Reader | ||
Helper function for Karma that makes reading JSON files easier | ||
|
||
## Install | ||
|
||
`bower install karma-read-json` | ||
`bower install karma-json-reader` | ||
|
||
## Usage | ||
|
||
1. Put karma-read-json.js in your Karma files, Example: | ||
1. Include karma-json-reader.js in your karma.conf.js. | ||
|
||
files = [ | ||
... | ||
'bower_components/karma-read-json/karma-read-json.js', | ||
... | ||
... | ||
'bower_components/karma-read-json/karma-json-reader.js', | ||
... | ||
] | ||
|
||
2. Make sure your JSON is being served by Karma, Example: | ||
2. Include your JSON data in your karma.conf.js. | ||
|
||
files = [ | ||
... | ||
{pattern: 'json/**/*.json', included: false}, | ||
... | ||
... | ||
{ pattern: 'test/data/*.json', watched: true, served: true, included: false }, | ||
... | ||
] | ||
|
||
3. Use the `readJSON` function in your tests. Example: | ||
3. Use `KarmaJSONReader` to get your JSON data. | ||
|
||
var valid_respond = readJSON('json/foobar.json'); | ||
$httpBackend.whenGET(/.*/).respond(valid_respond); | ||
var jsonReader = new KarmaJSONReader('path/to/json/files/'); | ||
var mockData = jsonReader.readJSON('mockData.json'); | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
{ | ||
"name": "karma-read-json", | ||
"version": "1.0.2", | ||
"homepage": "https://github.com/pizzapanther/Karma-Read-JSON", | ||
"authors": [ | ||
"Paul Bailey <[email protected]>" | ||
], | ||
"description": "helper function for Karma to read JSON files easier", | ||
"main": "karma-read-json.js", | ||
"keywords": [ | ||
"karma", | ||
"json" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
] | ||
"name": "karma-read-json", | ||
"version": "1.0.3", | ||
"homepage": "https://github.com/osidenate/Karma-Read-JSON", | ||
"authors": [ | ||
"Paul Bailey <[email protected]>", | ||
"Nathan Nelson <[email protected]>" | ||
], | ||
"description": "Helper function for Karma that makes reading JSON files easier", | ||
"main": "karma-read-json.js", | ||
"keywords": [ | ||
"karma", | ||
"json" | ||
], | ||
"license": "MIT", | ||
"ignore": [ | ||
"**/.*", | ||
"node_modules", | ||
"bower_components", | ||
"test", | ||
"tests" | ||
] | ||
} |
File renamed without changes.