forked from zuriby/Faker.js
-
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.
Merge pull request #837 from mrstebo/add-music-faker
Added the Music module
- Loading branch information
Showing
7 changed files
with
69 additions
and
0 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 |
---|---|---|
|
@@ -190,6 +190,8 @@ | |
* paragraphs | ||
* text | ||
* lines | ||
* music | ||
* genre | ||
* name | ||
* firstName | ||
* lastName | ||
|
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
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
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
module["exports"] = [ | ||
"Rock", | ||
"Metal", | ||
"Pop", | ||
"Electronic", | ||
"Folk", | ||
"World", | ||
"Country", | ||
"Jazz", | ||
"Funk", | ||
"Soul", | ||
"Hip Hop", | ||
"Classical", | ||
"Latin", | ||
"Reggae", | ||
"Stage And Screen", | ||
"Blues", | ||
"Non Music", | ||
"Rap" | ||
]; |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
var music = {}; | ||
module['exports'] = music; | ||
music.genre = require("./genre"); |
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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* | ||
* @namespace faker.music | ||
*/ | ||
var Music = function (faker) { | ||
var self = this; | ||
/** | ||
* genre | ||
* | ||
* @method faker.music.genre | ||
*/ | ||
self.genre = function () { | ||
return faker.random.arrayElement(faker.definitions.music.genre); | ||
}; | ||
|
||
self.genre.schema = { | ||
"description": "Generates a genre.", | ||
"sampleResults": ["Rock", "Metal", "Pop"] | ||
}; | ||
}; | ||
|
||
module["exports"] = Music; |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
if (typeof module !== 'undefined') { | ||
var assert = require('assert'); | ||
var sinon = require('sinon'); | ||
var faker = require('../index'); | ||
} | ||
|
||
describe("music.js", function () { | ||
describe("genre()", function () { | ||
it("returns a genre", function () { | ||
sinon.stub(faker.music, 'genre').returns('Rock'); | ||
var genre = faker.music.genre(); | ||
|
||
assert.equal(genre, 'Rock'); | ||
faker.music.genre.restore(); | ||
}); | ||
}); | ||
}); |