Skip to content

Jonny lab 13 & 14#8

Open
jonathanheemstra wants to merge 30 commits intocodefellows-seattle-javascript-401d12:masterfrom
jonathanheemstra:master
Open

Jonny lab 13 & 14#8
jonathanheemstra wants to merge 30 commits intocodefellows-seattle-javascript-401d12:masterfrom
jonathanheemstra:master

Conversation

@jonathanheemstra
Copy link
Copy Markdown

@jonathanheemstra jonathanheemstra commented Dec 29, 2016

Question:
When running my tests if I have to terminate any active servers that I am currently running. If don't then the tests will time out on the before and after hooks. Why does this happen?

Observation:
Writing two resource APIs requires that one resource is essentially the lead resource while the second resource is secondary. For instance in the case of my two resource API I needed to essentially establish the Directors collection as the primary on which all Movies (secondary collection) will be attached to. Each Director can have multiple Movies associated with them while each movie can only have one Director. I can see how when building a very large API with many more resources than 2 it would take quite a bit of planning in order to not be backed into a corner when building.

confirmed server is up and running
error middleware now handles validation and cast errors with appropriate status codes of 400 and 404 respectively.
set up directors model and modify movies model
});
});
it('should have properties of name, rating, timestamp, id, and directorID', done => {
expect(this.tempMovie).to.include.keys('name');
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests are awesome! Way to write 48 of them- totally sweet. There's a shorter way to check for all the keys, although the way you are doing it works totally fine, you could have also done something like:

expect({ foo: 1, bar: 2 }).to.have.all.keys(['bar', 'foo']);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants