Skip to content

Commit 63a4c5c

Browse files
committed
create _users if it doesnt exist and fail if the env variables are not set
1 parent 7c183df commit 63a4c5c

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

test/integration/install.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ let adminSessionCookie;
2323

2424
describe('install', () => {
2525
before(() => {
26+
if (source.includes('example.org')) {
27+
throw new Error('SOURCE_URL is not set to a valid test CouchDB instance. Please export SOURCE_URL=http://public:none@thecouchinstance.org');
28+
}
2629
// eslint-disable-next-line no-underscore-dangle
2730
replay._localhosts = new Set();
2831
// eslint-disable-next-line no-underscore-dangle
@@ -50,6 +53,19 @@ describe('install', () => {
5053
});
5154

5255
describe('_users views', () => {
56+
before(() => supertest(destination)
57+
.get('/_all_dbs')
58+
.set('Accept', 'application/json')
59+
.then((res) => {
60+
debug('res', res.body);
61+
expect(res.body).includes('_users', JSON.stringify(res.body));
62+
})
63+
.catch((err) => supertest(destination)
64+
.put('/_users')
65+
.set('Accept', 'application/json')
66+
.send({})
67+
));
68+
5369
it('should create the _users views', () => supertest(destination)
5470
.post('/_users')
5571
.set('cookie', adminSessionCookie)
@@ -71,7 +87,7 @@ describe('install', () => {
7187
})
7288
.then((res) => {
7389
if (res.body.error !== 'conflict') {
74-
expect(res.body.ok).to.equal(true);
90+
expect(res.body.ok).to.equal(true, JSON.stringify(res.body));
7591
}
7692

7793
return supertest(destination)

0 commit comments

Comments
 (0)