Skip to content

Latest commit

 

History

History
74 lines (61 loc) · 1.36 KB

dev.md

File metadata and controls

74 lines (61 loc) · 1.36 KB

Development

Node and npm

You can play with GraphQL by opening http://localhost:3060/graphql with a tool like Altair GraphQL.

For example, try this query:

query {
  collective(slug: "apex") {
    id
    slug
    name
    description
    tiers {
      nodes {
        id
        name
        description
        amount {
          value
          currency
        }
      }
    }
    members {
      nodes {
        id
        role
        account {
          id
          slug
          name
        }
        totalDonations {
          value
          currency
        }
      }
    }
  }
}

Tests

$> npm test

The tests delete all the opencollective_test database's tables and re-create them with the latest models.

All the calls to 3rd party services are stubbed using either sinon or nock.

If you get an error at the first test, you might have forgotten to run postgres. Use e.g. the following aliases to start/stop postgres:

export PGDATA='/usr/local/var/postgres'
alias pgstart='pg_ctl -l $PGDATA/server.log start'
alias pgstop='pg_ctl stop -m fast'

Running Scripts

There are many admin scripts in /scripts directory. To run them:

# Local development (without Docker)
$ npx babel-node ./scripts/populate_usernames.js