9
9
const Post = require ( '../post' )
10
10
const Author = require ( '../author' )
11
11
const mongoose = require ( 'mongoose' )
12
- const createConent = ( length , fill = 'b' ) => new Array ( length ) . fill ( fill ) . join ( '' )
12
+ const createContent = ( length , fill = 'b' ) => new Array ( length ) . fill ( fill ) . join ( '' )
13
13
14
14
describe ( 'queries' , ( ) => {
15
15
describe ( 'postByTitle' , ( ) => {
@@ -18,7 +18,7 @@ describe('queries', () => {
18
18
const post = await Post . create ( {
19
19
title,
20
20
author : mongoose . Types . ObjectId ( ) ,
21
- content : createConent ( 50 ) ,
21
+ content : createContent ( 50 ) ,
22
22
contentLength : 50
23
23
} )
24
24
@@ -33,7 +33,7 @@ describe('queries', () => {
33
33
const post = await Post . create ( {
34
34
author,
35
35
title : 'Carter v' ,
36
- content : createConent ( 50 ) ,
36
+ content : createContent ( 50 ) ,
37
37
contentLength : 50
38
38
} )
39
39
const [ match ] = await postsForAuthor ( author )
@@ -46,9 +46,9 @@ describe('queries', () => {
46
46
const author = mongoose . Types . ObjectId ( )
47
47
48
48
const posts = await Post . create ( [
49
- { title : 'Super Duper' , author, content : createConent ( 1000 ) , contentLength : 1000 } ,
50
- { title : 'Amazing' , author, content : createConent ( 100 ) , contentLength : 100 } ,
51
- { title : 'Other' , author, content : createConent ( 800 ) , contentLength : 800 }
49
+ { title : 'Super Duper' , author, content : createContent ( 1000 ) , contentLength : 1000 } ,
50
+ { title : 'Amazing' , author, content : createContent ( 100 ) , contentLength : 100 } ,
51
+ { title : 'Other' , author, content : createContent ( 800 ) , contentLength : 800 }
52
52
] )
53
53
54
54
const matches = await postByContentLength ( 1000 , 100 )
@@ -64,15 +64,15 @@ describe('queries', () => {
64
64
const post = await Post . create ( {
65
65
title : 'Super Duper' ,
66
66
author : author . id ,
67
- content : createConent ( 1000 ) ,
67
+ content : createContent ( 1000 ) ,
68
68
contentLength : 1000
69
69
} )
70
70
const post2 = await Post . create ( {
71
71
author : author . id ,
72
72
title : 'Post 2' ,
73
- content : createConent ( 100 ) ,
73
+ content : createContent ( 100 ) ,
74
74
contentLength : 100 ,
75
- simularPosts : [ post . id ]
75
+ similarPosts : [ post . id ]
76
76
} )
77
77
78
78
const match = await fullPostById ( post2 . id )
@@ -83,9 +83,9 @@ describe('queries', () => {
83
83
test ( 'only selects fields given' , async ( ) => {
84
84
const author = mongoose . Types . ObjectId ( )
85
85
await Post . create ( [
86
- { title : 'learn things' , content : createConent ( 100 ) , contentLength : 100 , author} ,
87
- { title : 'lean more things' , content : createConent ( 100 ) , contentLength : 100 , author} ,
88
- { title : 'lean more things++' , content : createConent ( 100 ) , contentLength : 100 , author}
86
+ { title : 'learn things' , content : createContent ( 100 ) , contentLength : 100 , author} ,
87
+ { title : 'lean more things' , content : createContent ( 100 ) , contentLength : 100 , author} ,
88
+ { title : 'lean more things++' , content : createContent ( 100 ) , contentLength : 100 , author}
89
89
] )
90
90
91
91
const matches = await allPostsSlim ( { title : 1 , content : 1 } )
@@ -98,12 +98,12 @@ describe('queries', () => {
98
98
} )
99
99
} )
100
100
describe ( 'addRelatedPosts' , ( ) => {
101
- test ( 'should not overrided related posts that are there' , async ( ) => {
101
+ test ( 'should not override related posts that are there' , async ( ) => {
102
102
const author = mongoose . Types . ObjectId ( )
103
103
const post = await Post . create ( {
104
104
author,
105
105
title : 'Post' ,
106
- content : createConent ( 100 ) ,
106
+ content : createContent ( 100 ) ,
107
107
contentLength : 100 ,
108
108
similarPosts : [ mongoose . Types . ObjectId ( ) ]
109
109
} )
0 commit comments