forked from AdaGold/video-store-api
-
Notifications
You must be signed in to change notification settings - Fork 13
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
Video Store API - Jess & Adriana #9
Open
jweeber
wants to merge
99
commits into
Ada-C5:master
Choose a base branch
from
jweeber:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
99 commits
Select commit
Hold shift + click to select a range
a11a00f
created routes files, pseudocode and lib file
jweeber 991bd14
pseudocoded all the routes. ALL OF THEM
jweeber 9e4894d
semicolon destructiongit add .
jweeber 36c5ab2
completed /zomg route, json is successful
jweeber da05488
Added an images folder and inside put our ERD
dri19tcc f8ba0ae
Added massive dependencies, added extra scripts for our database
dri19tcc 2c42d48
added load_schema with all database tables and what they will need. …
dri19tcc 32edfb7
route for customers index created
jweeber cf26e91
movies index route created
jweeber 9fc335b
added rentals/:title route
jweeber b9741f8
Added seeding data into database, changed schema for rentals to text,…
dri19tcc 769fbe8
Trying to get data to customers page
dri19tcc 01145b5
Added in controllers and customers to get json data as the output
dri19tcc 8d3924c
getting all customers working
jweeber d44c8ac
moved customer.all function to model and rendered json data from cont…
jweeber 5821a8d
added first fucking test for customers controller and it is PASSING
jweeber e238cae
added two more passing tests weeee
jweeber b194f8b
Added a show page for just one customer
dri19tcc a53ef69
Added in a sort by function that can sort by different fields, and ad…
dri19tcc aa21741
cleaned up code
dri19tcc a8d7a0a
get /movies working to retrieve all movies. routes created for /:id a…
jweeber 84501a7
model and controller methods for find and sort working for movies.
jweeber 05f7e0a
three tests for movies done and passing
jweeber dcd0b51
test for finding a movie based on title written and passing
jweeber db04330
minor movies test revision to use var for title and remove magic string
jweeber 1a848f6
Added in more tests for customers. Added a negative test for giving …
dri19tcc 2205615
Added in negative tests for movies and for customers
dri19tcc e7f12f1
Took out lower level error
dri19tcc 78b0ef5
added movie_id to schema
jweeber 529da05
find all movies that can be rented works. find rentals by title now w…
jweeber 47c9e4f
changed schema
dri19tcc 63a2dc8
Added in controller testing
dri19tcc 65ad737
Added in controller testing for rentals for show page
dri19tcc 5bdd0d2
Added customer testing for show page
dri19tcc ff1ca1a
Cleaned up customers controller page
dri19tcc 5d34cc3
Added jasmine-testing so errors will show
dri19tcc 05e2ced
Added rental tests
dri19tcc b04c9e9
Have all passing tests for all controllers and functions and all mode…
dri19tcc 440cae3
added temporary seed data to test customer routes for current checked…
jweeber 955c5d9
findRentals method in model retrieving rentals data from temp seeded …
jweeber 42f00a0
rental history for customers working with temp seed data
jweeber 2dee49d
created sql file for inner joining rentals, movies, customers. return…
jweeber cc8267f
trying to get current movies out
dri19tcc ef51688
Debugging movies rental history
dri19tcc fdeb7ce
one customer showing up for current rentals.
jweeber 3d331b7
finally got list of customers who currently have specific movie check…
jweeber eb7550b
Added a checkout date column for rentals
dri19tcc 6d405c5
Cleaned up code
dri19tcc e1880ae
Added controller testing and adding coverage to git ignore
dri19tcc fd5b67c
Added model testing
dri19tcc 51fbee5
writing tests for rentals, working on negative tests
jweeber d474782
Added negative tests
dri19tcc 675cbb0
Cleaned up rental spec code, if using find, no callback error is given
dri19tcc 0a0a408
working on get currently checked out movies customers
jweeber 54b8a52
merging rentals model with removing error handling
jweeber 64f37a0
Took out error handling because no errors passed when using the .find…
dri19tcc 4d4b7e7
finished tests for rentals model so far
jweeber 99b79af
Merge branch 'master' of github.com:jweeber/VideoStoreAPI
dri19tcc 4651ad4
finished tests for customer model
jweeber 9e37fb4
Added more seeding data, added movies route
dri19tcc 3724763
Added a new sql file to query customer rental history, added a new ro…
dri19tcc 2911550
Added an index controller so route testing would be at 100%
dri19tcc 3a665c2
Added current rentals and started on post
dri19tcc ffa61bc
Adding post route
dri19tcc 2e9d342
Working on checkout posting data
dri19tcc 5d5624f
post to checkout working. we fancy! saving to rentals database as che…
jweeber 7c59385
Rental method for chekcout now successfully reducing inventory
jweeber 5584486
return date calculates and saves to rental database
jweeber 52fcae5
extracting logic from rental checkout method for reusability. added l…
jweeber 3a5c9f3
added router for rental checkin, plus controller method and model met…
jweeber f035554
got error handling working for when inventory is less than 1
jweeber 2678ec4
Added a find by id method
dri19tcc a189ac7
Added function to charge a customer 1.00 to rent out. Went into the …
dri19tcc 2fc868d
Made put routes, and renamed functions as put
dri19tcc 935a54c
Changed rental database to false and added to movie inventory when re…
dri19tcc d5d4db6
Added ; in sql query, renamed so functions matched
dri19tcc 075bed0
made routes and started method for overdue
dri19tcc f6698f6
overdue rentals model working to return rentals, working on getting i…
jweeber 2e0369e
Found a missing token
dri19tcc c166224
Added a sql file to join customers and rentals
dri19tcc 2366743
Sql file is working, yay
dri19tcc e6a0e2e
Finished function to return customers that have late data
dri19tcc a330a7a
updating
dri19tcc 9cd7d07
merging
jweeber adab1a0
merge conflict
jweeber 2e97025
fixed customer rental history to order by checkout and show movies
jweeber 50740f6
fixed current rentals by customer to show movies
jweeber 417de7e
fixing sql for movie rental history showing customers
jweeber 4092545
fixed overdue rentals to show info for customer and movies
jweeber 6e8adf2
fixed tests after changing methods in rental model to use sql
jweeber bb39da2
don't know
dri19tcc 5b51525
merge conflicts
dri19tcc 04e0654
Added a new directory that will hold api json doc, started writing up…
dri19tcc 90e9a3f
tried more tests for rentals. some are just not working out.
jweeber dcfe8e5
merging tests
jweeber 79d1d86
got another test working so up to 90% coverage for models
jweeber a8a4603
cleaning up test file
jweeber 32e4fb0
json docs
dri19tcc 182a16b
merging
dri19tcc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Empty file.
Empty file.
Empty file.
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 |
---|---|---|
|
@@ -71,8 +71,6 @@ describe('Rental', function () { | |
describe("#findCurrent", function () { | ||
it("should return current rentals for a customer", function (done) { | ||
Rental.findCurrent(29, function (error, movie) { | ||
console.log(movie) | ||
expect(movie.length).toEqual(3) | ||
expect(movie[0].id).toEqual(19) | ||
done() | ||
}) | ||
|
@@ -110,5 +108,63 @@ describe('Rental', function () { | |
}) | ||
}) | ||
|
||
describe("#findHistoryMovies", function () { | ||
it("should return rental history for a movie", function (done) { | ||
Rental.findHistoryMovies('Die Hard', function (error, rentals) { | ||
expect(rentals.length).toEqual(2) | ||
expect(rentals[0].id).toEqual(29) | ||
done() | ||
}) | ||
}) | ||
|
||
it('should throw an error if no rentals found', function (done) { | ||
Rental.findHistoryMovies("bad title", function(error, movie) { | ||
expect(error).toEqual(null) | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
describe("#find_customers", function () { | ||
it("should return customers who rented a given movie", function (done) { | ||
Rental.find_customers('Die Hard', function (error, customers) { | ||
expect(customers.length).toEqual(2) | ||
expect(customers[0].id).toEqual(19) | ||
done() | ||
}) | ||
}) | ||
|
||
it('should throw an error if no customers found', function (done) { | ||
Rental.findHistoryMovies("bad title", function(error, movie) { | ||
expect(error).toEqual(null) | ||
done() | ||
}) | ||
}) | ||
}) | ||
|
||
describe("#checkout", function () { | ||
it("should checkout correct movie and decrease movie inventory when checked out", function (done) { | ||
var preStock; | ||
Rental.find('Speed', function(error, movie) { | ||
preStock = movie[0].inventory | ||
}) | ||
Rental.checkout("Speed", 29, function(error, movie){}) | ||
Rental.find('Speed', function(error, movie) { | ||
var postStock = movie[0].inventory | ||
expect(movie[0].title).toEqual('Speed') | ||
expect(postStock).toEqual(preStock - 1) | ||
}) | ||
done() | ||
}) | ||
}) | ||
|
||
describe("#overdueRental", function () { | ||
it("should return list of customers with overdue rentals", function (done) { | ||
Rental.overdueRental(function (error, customers) { | ||
expect(customers.length).toEqual(2) | ||
}) | ||
done() | ||
}) | ||
}) | ||
|
||
}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your coverage is awesome! |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job with the tests!!
For a cleaner code I would recommend you to be consistence when you choose to use variables. in line 153 you used var postStock = movie[0].inventory. So I would expect that next you'll have also variable for the movie[0].title.
Or that you just won't use the postStock, and use the raw data in the test.
But other then that - looks great!