Skip to content
This repository has been archived by the owner on Sep 8, 2020. It is now read-only.

Fixing issues #3, #9, #11 #17

Closed
wants to merge 17 commits into from
Closed

Conversation

sfrankian
Copy link

So far I've done issues #3, #9, and #11, but will open another pull request for future issue fixes.

Also, thanks for the fun assignment!

sfrankian added 14 commits May 26, 2018 22:04
…ect if a 'people' API request didn't return OK.
…ship components are not available, just linking to API for now.
…sults in the datastore (binxhealth#3). Also added back in error handling for incorrect people path - relates to binxhealth#9.
@CLAassistant
Copy link

CLAassistant commented May 29, 2018

CLA assistant check
All committers have signed the CLA.

@ianwalter
Copy link
Contributor

Oops, looks like I didn't configure the continuous integration service to test forks. I'm going to leave some minor feedback on your changes. Would you mind addressing this feedback and pushing a new commit? That should trigger the CI build.

@ianwalter ianwalter self-assigned this May 29, 2018
@ianwalter ianwalter self-requested a review May 29, 2018 02:55
localVue.use(Vuex)
localVue.use(VueRouter)

test('Home renders correctly', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This test description should probably say Person instead of Home.

Copy link
Contributor

@ianwalter ianwalter left a comment

Choose a reason for hiding this comment

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

Great job! I left some feedback but don't feel obligated to follow up. Thanks for working on this.

@@ -3,3 +3,20 @@ describe('Home', () => {
cy.visit('/')
})
})
describe('PageNotFound', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: space above.

})
})

describe('People', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

With BDD style you'd want to have unique describe blocks containing multiple it blocks if necessary. The it block below could join the other it block above.

@@ -8,7 +8,7 @@
<div class="d-flex flex-wrap">
<router-link
v-for="(person, id) in results"
:to="`/people/${id}`"
:to="`/people/${id + 1}`"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice

<div class="row pt-3 pl-3">
<router-link
:to="`/`">
<button>Return home</button>
Copy link
Contributor

Choose a reason for hiding this comment

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

Tip: you can make router-link into a button with the as property.

await store.dispatch('people/get', to.params.id)
next()
const resp = await store.dispatch('people/getPerson', to.params.id)
// If we receive null back as a response, we redirect back to the home page
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: A better way to handle this would have been with a try-catch block.

if (response.ok) {
return response.json()
} else {
return null
Copy link
Contributor

Choose a reason for hiding this comment

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

You generally don't want to be returning values in store actions. The data should flow in a single direction so that the store is the single source of truth for consumers.

}
},
getters: {
getResults: state => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't a useful getter since it's only returning the state which can already be retrieved by other methods.

localVue.use(Vuex)

const results = {
'name': 'Darth Vader',
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI: quotes not necessary for object keys.

'results': results
}

var store = new Vuex.Store({
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why we're creating a new store here instead of just importing the actual store like in home.test.js.

@@ -0,0 +1,14 @@
<template>
<div class="container-fluid">
<h2>Uh oh, the force was not with that request.</h2>
Copy link
Contributor

Choose a reason for hiding this comment

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

This is great!

@ianwalter ianwalter closed this May 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants