hoodiehq / camp

:circus_tent: Welcome to Hoodie Camp!
https://hoodie.camp
Apache License 2.0
99 stars 55 forks source link

[Hoodie Account Server API] friendly error message for accounts.add({username: ''}) #60

Closed LowProfileDog closed 7 years ago

LowProfileDog commented 7 years ago

This issue is reserved for Fullstack ⚑️ Open Source | Hacktober Edition

πŸŽƒπŸ’»πŸ‘• Hacktoberfest: Trick or Treat!

If you haven’t yet, sign up for Hacktoberfest to earn an exclusive T-Shirt. Plus I’m sure we can teach you a cool trick or two in the process

πŸ€” What you will need to know

You should have worked with JavaScript, Node.js and Testing. If you haven’t yet, we recommend the JavaScript Track on exercism.io

🐞 The Bug

var AccountApi = require('@hoodie/account-server-api')

var AccountApi = require('.')
var PouchDB = require('pouchdb-core').plugin(require('pouchdb-adapter-memory')).plugin(require('pouchdb-mapreduce'))

var api = new AccountApi({
  PouchDB: PouchDB,
  secret: 'secret123'
})

api.accounts.add({}).catch(function (error) {
  // forbidden: doc.name is required
}) 

We prepared a test to reproduce this issue at test/unit/accounts/add-test.js#L6

:dart: The goal

Make the test pass :)

:clipboard: Step by Step

If this is your first, welcome :tada: :smile: Here is a great tutorial on how to send a pull request using the terminal.

Ping us in the Hoodie Chat or on Twitter

simonyangme commented 7 years ago

Claiming

LowProfileDog commented 7 years ago

The issue is all yours :) I’ve invited you to our Camp repository, you can accept my invitation at https://github.com/hoodiehq/camp/invitations

Once accepted, you can assign yourself to this issue and check off the checkboxes above. Enjoy πŸ•

simonyangme commented 7 years ago

@LowProfileDog please review :smile_cat: