Skip to content

Week 2: Michelle & Mindy (Join existing shopping list)

Mindy Zwanziger edited this page Nov 22, 2019 · 11 revisions

Joining a List

  • User enters an existing token
    • Show an error if the token does not exist
    • Allow them to try again or start a new list
  • Save the token to localStorage
  • Show the user the existing list

AC

On the onboarding screen, the user can tap to reveal a field where they can enter an existing token. Entering the token and hitting submit saves the token to localStorage, effectively giving them joint control of the list.

Notes

  • In the iNeedToBuy.xyz example app - there's a "join existing list" link on the original home page
  • Will need a "Join" page.
  • A field to enter token on join page
  • Will need an error page with links Using an alert instead
  • Will need to edit path in fetchItems and addItem

Testing

  • The 'happy path' - does this mean not testing when it's an invalid token?

Accessibility

Notes from 11/18/19:

Potentially use a collection within a collection on firebase => path to the collection for a particular token. We're going to study up on localStorage (how to save to & retrieve from). Study up on testing particular pieces of this.

Notes from 11/22/19:

Were able to get the token into localStorage fairly simply, but had a hard time checking if the entered token was in the database. Landed on accessing the database directly and not relying on react-firestore. So added this line to firebase.js: const db = fb.firestore(); and then was able to put this code in to access the database in the JoinList component:

    db
      .collection("lists")
      .doc(token)
      .get()
      .then(function(doc) { function here }

Everything was working correctly in that a valid token added it to localStorage and an invalid one gave us an alert, but can't tried creating a test to check that an alert would pop up when an invalid token was received, and can't get that to pass.

Resources

Testing examples with Cypress

Testing an Alert

Redirecting in React

Getting data from a Firebase doc

Storing Firebase Instance in a Variable

Clone this wiki locally