Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/with tests #19

Open
wants to merge 54 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
4839e11
dependencies and test command
Dec 8, 2016
65097f7
fix `.grade` gen logic
Dec 13, 2016
aba42ea
use promise
Dec 13, 2016
07a8678
tests written and passing
Dec 13, 2016
fa30c05
don't use expect
Dec 14, 2016
3b0bdd9
fix null assertion
Dec 14, 2016
794f21b
improve test
Dec 14, 2016
6f385d6
remove arrow functions
Dec 14, 2016
51a6922
remove `catch` so tests fail
Dec 15, 2016
6247bc8
remove done
Dec 15, 2016
c82e98e
add closeServer function
Dec 15, 2016
ed7d84b
Merge branch 'master' into feature/with-tests
Dec 15, 2016
b13dd49
add .exec
Dec 15, 2016
e3e7efa
close server
Dec 15, 2016
81283ef
Merge branch 'feature/redo-with-promises' into feature/with-tests
Dec 15, 2016
124ad6f
cleanup
Dec 15, 2016
e807c21
add `return`
Dec 16, 2016
20ea9be
already returns a promise
Dec 19, 2016
9fc062f
return response
Dec 20, 2016
244f8dd
pass database url
Dec 22, 2016
fb39df3
fix required field validation
Jan 24, 2017
c8167aa
correct the logs
Feb 14, 2017
0cbb728
Fix comment typo
Rosuav Feb 24, 2017
0678c6a
remove redundant assertion
May 30, 2017
3dee080
remove unnec. .exec
Aug 24, 2017
ca2ff51
Merged `useMongoClient` and related cleanup
cklanac Nov 28, 2017
d22e085
remove scratch file
cklanac Dec 4, 2017
dca9c57
Merge pull request #8 from Thinkful-Ed/fix/use-mongo-client/with-tests
cklanac Dec 4, 2017
926ae3b
add exit flag
Dec 5, 2017
735654f
update mocha
Dec 6, 2017
601b651
rename apiRepr to serialize
Dec 6, 2017
61bb399
Merge pull request #11 from Thinkful-Ed/feature/with-tests-rename-api…
Dec 6, 2017
5e75f54
fix: semi-colons
cklanac Dec 8, 2017
ba6405d
Merge pull request #4 from Rosuav/patch-1
cklanac Dec 8, 2017
cac3871
update lock file
cklanac Dec 8, 2017
e6fc39f
Merge branch 'feature/with-tests' of https://github.com/Thinkful-Ed/n…
cklanac Dec 8, 2017
8afef4d
add TEST_DATABASE_URL to config.js
tsongas Jan 4, 2018
dd59127
change should to expect
tsongas Jan 4, 2018
5543264
Merge pull request #13 from tsongas/feature/with-tests
Jan 6, 2018
f41c87a
fix: temp fix for #462. Remove liimit(10)
cklanac Jan 10, 2018
3f03955
fix: TEST_DATABASE_URL
cklanac Jan 10, 2018
b0ac0e3
Merge branch 'master' of github.com:Thinkful-Ed/node-restaurants-app-…
tsongas Jan 13, 2018
8f10b15
use test database
tsongas Jan 13, 2018
2a23ddd
update test db url
tsongas Jan 13, 2018
a9510f5
Merge pull request #14 from tsongas/feature/with-tests
cklanac Jan 15, 2018
707c934
update mongoose
cklanac Feb 28, 2018
2e5b06e
version updates
tsongas Apr 5, 2018
f67d878
change length.of to lengthOf
tsongas Apr 5, 2018
c8ce4a2
fix typo
tsongas Apr 5, 2018
18cb4f6
remove body-parser from app
tsongas Apr 20, 2018
567e0f6
add package-lock.json after running npm install
tsongas Apr 20, 2018
9147424
Merge pull request #16 from tsongas/feature/with-tests
cklanac Apr 29, 2018
3651977
update dependencies
tsongas Jun 10, 2018
1a3bab9
put back accidental deletion
tsongas Jun 28, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
language: node_js
node_js: node
services:
- mongodb
Empty file added README.md
Empty file.
1 change: 1 addition & 0 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
exports.DATABASE_URL = process.env.DATABASE_URL || 'mongodb://localhost/restaurants-app';
exports.TEST_DATABASE_URL = process.env.TEST_DATABASE_URL || 'mongodb://localhost/test-restaurants-app';
exports.PORT = process.env.PORT || 8080;
6 changes: 3 additions & 3 deletions models.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ const restaurantSchema = mongoose.Schema({
// to generate a human readable string based on the address object
// we're storing in Mongo.
restaurantSchema.virtual('addressString').get(function() {
return `${this.address.building} ${this.address.street}`.trim()});
return `${this.address.building} ${this.address.street}`.trim();});

// this virtual grabs the most recent grade for a restaurant.
restaurantSchema.virtual('grade').get(function() {
const gradeObj = this.grades.sort((a, b) => {return b.date - a.date})[0] || {};
const gradeObj = this.grades.sort((a, b) => {return b.date - a.date;})[0] || {};
return gradeObj.grade;
});

Expand All @@ -49,7 +49,7 @@ restaurantSchema.methods.serialize = function() {
grade: this.grade,
address: this.addressString
};
}
};

// note that all instance methods and virtual properties on our
// schema must be defined *before* we make the call to `.model`.
Expand Down
Loading