-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost_test.js
55 lines (52 loc) · 1.57 KB
/
post_test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
const asert = require('assert')
const mongoose = require('mongoose')
const Post = require('../models/post')
const User = require('../models/user')
// test descriptions
describe('Nesting records', function () {
it('Create a post with sub-documents', function (done) {
var test = new User({
name: {
name: "bob angers",
},
email: {
email: "[email protected]",
},
username: {
username: "bobA",
},
password: {
password: "bob",
},
posts: [
{
title: "first test post",
},
{
description: "testing the nesting of posts in the mongodb lets hope this fucker works",
},
{
category: "electric",
},
{
subcategory: "fresnel",
},
{
item: "19 fresnely fresnels",
},
{
deathDate: "12/24/2019",
},
{
specifics: "19 45 inch fresnel mcgee rocks set to be picked up and taken away by jungle johns awesome machine gun shop used slightly. Painted green",
}
],
});
test.save().then(function(){
post.findOne({name:'bob angers'}).then(function(res){})
assert(res.posts.length === 1);
done ();
});
}
)
})