Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split badge & barcode endpoints to their own module #63

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Add tests for site-selection token & voter lists
eemeli committed Sep 13, 2018
commit 6e361066c0c99936b53aad6b8f69474060327856
42 changes: 35 additions & 7 deletions integration-tests/test/siteselect.spec.js
Original file line number Diff line number Diff line change
@@ -38,14 +38,42 @@ describe('Site selection', () => {
})
})

it('member: get own ballot', () => {
return member
it('member: get own ballot', () =>
member
.get(`/api/people/${id}/ballot`)
.expect(200)
.expect('Content-Type', 'application/pdf')
})
.expect('Content-Type', 'application/pdf'))

it("member: fail to get others' ballot", () => {
return member.get(`/api/people/${id - 1}/ballot`).expect(401)
})
it("member: fail to get others' ballot", () =>
member.get(`/api/people/${id - 1}/ballot`).expect(401))

it('member: fail to list tokens', () =>
member.get(`/api/siteselect/tokens.json`).expect(401))

it('member: fail to list voters', () =>
member.get(`/api/siteselect/voters.json`).expect(401))

it('admin: list tokens as JSON', () =>
admin
.get(`/api/siteselect/tokens.json`)
.expect(200)
.expect(res => assert(Array.isArray(res.body))))

it('admin: list tokens as CSV', () =>
admin
.get(`/api/siteselect/tokens.csv`)
.expect(200)
.expect('Content-Type', /text\/csv/))

it('admin: list voters as JSON', () =>
admin
.get(`/api/siteselect/voters.json`)
.expect(200)
.expect(res => assert(Array.isArray(res.body))))

it('admin: list voters as CSV', () =>
admin
.get(`/api/siteselect/voters.csv`)
.expect(200)
.expect('Content-Type', /text\/csv/))
})