-
-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
288 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {createAuthor, getRandomUUID, truncateEntities} from '../../../../test-helpers/create-entities'; | ||
|
||
import app from '../../../../../src/server/app'; | ||
import chai from 'chai'; | ||
import chaiHttp from 'chai-http'; | ||
|
||
|
||
chai.use(chaiHttp); | ||
const {expect} = chai; | ||
|
||
describe('Author routes', () => { | ||
const aBBID = getRandomUUID(); | ||
const inValidBBID = 'have-you-seen-the-fnords'; | ||
|
||
before(async () => { | ||
await createAuthor(aBBID); | ||
}); | ||
after(truncateEntities); | ||
|
||
it('should throw an error if requested BBID is invalid', (done) => { | ||
chai.request(app) | ||
.get(`/author/${inValidBBID}`) | ||
.end((err, res) => { | ||
expect(err).to.be.null; | ||
expect(res).to.have.status(400); | ||
done(); | ||
}); | ||
}); | ||
it('should not throw an error if creating new author', async () => { | ||
const res = await chai.request(app) | ||
.get('/author/create'); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error if requested author BBID exists', async () => { | ||
const res = await chai.request(app) | ||
.get(`/author/${aBBID}`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error trying to edit an existing author', async () => { | ||
const res = await chai.request(app) | ||
.get(`/author/${aBBID}/edit`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {createEditionGroup, getRandomUUID, truncateEntities} from '../../../../test-helpers/create-entities'; | ||
|
||
import app from '../../../../../src/server/app'; | ||
import chai from 'chai'; | ||
import chaiHttp from 'chai-http'; | ||
|
||
|
||
chai.use(chaiHttp); | ||
const {expect} = chai; | ||
|
||
describe('Edition Group routes', () => { | ||
const aBBID = getRandomUUID(); | ||
const inValidBBID = 'have-you-seen-the-fnords'; | ||
|
||
before(async () => { | ||
await createEditionGroup(aBBID); | ||
}); | ||
after(truncateEntities); | ||
|
||
it('should throw an error if requested BBID is invalid', (done) => { | ||
chai.request(app) | ||
.get(`/edition-group/${inValidBBID}`) | ||
.end((err, res) => { | ||
expect(err).to.be.null; | ||
expect(res).to.have.status(400); | ||
done(); | ||
}); | ||
}); | ||
it('should not throw an error if creating new edition-group', async () => { | ||
const res = await chai.request(app) | ||
.get('/edition-group/create'); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error if requested edition group BBID exists', async () => { | ||
const res = await chai.request(app) | ||
.get(`/edition-group/${aBBID}`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error trying to edit an existing edition group', async () => { | ||
const res = await chai.request(app) | ||
.get(`/edition-group/${aBBID}/edit`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {createEdition, getRandomUUID, truncateEntities} from '../../../../test-helpers/create-entities'; | ||
|
||
import app from '../../../../../src/server/app'; | ||
import chai from 'chai'; | ||
import chaiHttp from 'chai-http'; | ||
|
||
|
||
chai.use(chaiHttp); | ||
const {expect} = chai; | ||
|
||
describe('Edition routes', () => { | ||
const aBBID = getRandomUUID(); | ||
const inValidBBID = 'have-you-seen-the-fnords'; | ||
|
||
before(async () => { | ||
await createEdition(aBBID); | ||
}); | ||
after(truncateEntities); | ||
|
||
it('should throw an error if requested BBID is invalid', (done) => { | ||
chai.request(app) | ||
.get(`/edition/${inValidBBID}`) | ||
.end((err, res) => { | ||
expect(err).to.be.null; | ||
expect(res).to.have.status(400); | ||
done(); | ||
}); | ||
}); | ||
it('should not throw an error if creating new edition', async () => { | ||
const res = await chai.request(app) | ||
.get('/edition/create'); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error if requested edition BBID exists', async () => { | ||
const res = await chai.request(app) | ||
.get(`/edition/${aBBID}`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error trying to edit an existing edition', async () => { | ||
const res = await chai.request(app) | ||
.get(`/edition/${aBBID}/edit`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {createPublisher, getRandomUUID, truncateEntities} from '../../../../test-helpers/create-entities'; | ||
|
||
import app from '../../../../../src/server/app'; | ||
import chai from 'chai'; | ||
import chaiHttp from 'chai-http'; | ||
|
||
|
||
chai.use(chaiHttp); | ||
const {expect} = chai; | ||
|
||
describe('Publisher routes', () => { | ||
const aBBID = getRandomUUID(); | ||
const inValidBBID = 'have-you-seen-the-fnords'; | ||
|
||
before(async () => { | ||
await createPublisher(aBBID); | ||
}); | ||
after(truncateEntities); | ||
|
||
it('should throw an error if requested BBID is invalid', (done) => { | ||
chai.request(app) | ||
.get(`/publisher/${inValidBBID}`) | ||
.end((err, res) => { | ||
expect(err).to.be.null; | ||
expect(res).to.have.status(400); | ||
done(); | ||
}); | ||
}); | ||
it('should not throw an error if creating new publisher', async () => { | ||
const res = await chai.request(app) | ||
.get('/publisher/create'); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error if requested publisher BBID exists', async () => { | ||
const res = await chai.request(app) | ||
.get(`/publisher/${aBBID}`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error trying to edit an existing publisher', async () => { | ||
const res = await chai.request(app) | ||
.get(`/publisher/${aBBID}/edit`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import {createWork, getRandomUUID, truncateEntities} from '../../../../test-helpers/create-entities'; | ||
|
||
import app from '../../../../../src/server/app'; | ||
import chai from 'chai'; | ||
import chaiHttp from 'chai-http'; | ||
|
||
|
||
chai.use(chaiHttp); | ||
const {expect} = chai; | ||
|
||
describe('Work routes', () => { | ||
const aBBID = getRandomUUID(); | ||
const inValidBBID = 'have-you-seen-the-fnords'; | ||
|
||
before(async () => { | ||
await createWork(aBBID); | ||
}); | ||
after(truncateEntities); | ||
|
||
it('should throw an error if requested BBID is invalid', (done) => { | ||
chai.request(app) | ||
.get(`/work/${inValidBBID}`) | ||
.end((err, res) => { | ||
expect(err).to.be.null; | ||
expect(res).to.have.status(400); | ||
done(); | ||
}); | ||
}); | ||
it('should not throw an error if creating new work', async () => { | ||
const res = await chai.request(app) | ||
.get('/work/create'); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error if requested work BBID exists', async () => { | ||
const res = await chai.request(app) | ||
.get(`/work/${aBBID}`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
it('should not throw an error trying to edit an existing work', async () => { | ||
const res = await chai.request(app) | ||
.get(`/work/${aBBID}/edit`); | ||
expect(res.ok).to.be.true; | ||
expect(res).to.have.status(200); | ||
}); | ||
}); |
Oops, something went wrong.