forked from FrontendMasters/testing-workshop
-
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
Kent C. Dodds
committed
Mar 10, 2017
1 parent
44c6697
commit b896ddf
Showing
14 changed files
with
69 additions
and
65 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
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,20 +1,14 @@ | ||
import faker from 'faker' | ||
import mongoose from 'mongoose' | ||
import generateArticleData | ||
from '../../src/models/__tests__/helpers/generate/article' | ||
import getArticleSchema from '../../src/models/article' | ||
import {commonProps} from './utils' | ||
|
||
const Article = mongoose.model('Article', getArticleSchema()) | ||
|
||
export default createArticle | ||
|
||
function createArticle(author) { | ||
return Object.assign( | ||
new Article({ | ||
...commonProps(author.createdAt), | ||
...generateArticleData(author), | ||
}), | ||
{_id: faker.random.uuid()}, | ||
) | ||
return { | ||
...commonProps(author.createdAt), | ||
...generateArticleData(author), | ||
_id: mongoose.Types.ObjectId(), | ||
} | ||
} |
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,20 +1,15 @@ | ||
import faker from 'faker' | ||
import mongoose from 'mongoose' | ||
import getCommentSchema from '../../src/models/comment' | ||
import faker from 'faker' | ||
import {commonProps} from './utils' | ||
|
||
const Comment = mongoose.model('Comment', getCommentSchema()) | ||
|
||
export default createComment | ||
|
||
function createComment(article, author) { | ||
return Object.assign( | ||
new Comment({ | ||
...commonProps(article.createdAt), | ||
article: article._id, | ||
author: author._id, | ||
body: faker.lorem.sentences(), | ||
}), | ||
{_id: faker.random.uuid()}, | ||
) | ||
return { | ||
...commonProps(article.createdAt), | ||
article: article._id, | ||
author: author._id, | ||
body: faker.lorem.sentences(), | ||
_id: mongoose.Types.ObjectId(), | ||
} | ||
} |
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 |
---|---|---|
@@ -1,19 +1,13 @@ | ||
import faker from 'faker' | ||
import mongoose from 'mongoose' | ||
import getUserSchema from '../../src/models/user' | ||
import generateUserData from '../../src/models/__tests__/helpers/generate/user' | ||
import {commonProps} from './utils' | ||
|
||
const User = mongoose.model('User', getUserSchema()) | ||
|
||
export default createUser | ||
|
||
function createUser(overrides = {}) { | ||
return Object.assign( | ||
new User({ | ||
...commonProps(), | ||
...generateUserData(overrides), | ||
}), | ||
{_id: faker.random.uuid()}, | ||
) | ||
return { | ||
...commonProps(), | ||
...generateUserData(overrides), | ||
_id: mongoose.Types.ObjectId(), | ||
} | ||
} |
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
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
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 |
---|---|---|
|
@@ -18,18 +18,14 @@ acorn-jsx@^3.0.0: | |
dependencies: | ||
acorn "^3.0.4" | ||
|
||
[email protected]: | ||
[email protected], acorn@^4.0.3, acorn@^4.0.4: | ||
version "4.0.4" | ||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a" | ||
|
||
acorn@^3.0.4: | ||
version "3.3.0" | ||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a" | ||
|
||
acorn@^4.0.3, acorn@^4.0.4: | ||
version "4.0.11" | ||
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.11.tgz#edcda3bd937e7556410d42ed5860f67399c794c0" | ||
|
||
ajv-keywords@^1.0.0, ajv-keywords@^1.1.1: | ||
version "1.5.1" | ||
resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" | ||
|
@@ -3852,7 +3848,7 @@ xtend@^4.0.0, xtend@~4.0.1: | |
version "4.0.1" | ||
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.1.tgz#a5c6d532be656e23db820efb943a1f04998d63af" | ||
|
||
"xvfb@github:cypress-io/node-xvfb": | ||
xvfb@cypress-io/node-xvfb: | ||
version "0.3.0" | ||
resolved "https://codeload.github.com/cypress-io/node-xvfb/tar.gz/22e3783c31d81ebe64d8c0df491ea00cdc74726a" | ||
|
||
|