Skip to content

Commit 8f119bf

Browse files
committed
reduce duplication
1 parent 63a4c5c commit 8f119bf

1 file changed

Lines changed: 3 additions & 67 deletions

File tree

test/integration/install.js

Lines changed: 3 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ const source = process.env.SOURCE_URL;
2020
debug('destination', destination);
2121
debug('source', source);
2222
let adminSessionCookie;
23+
const usersDBname = config.usersDbConnection.dbname;
2324

2425
describe('install', () => {
2526
before(() => {
@@ -55,13 +56,15 @@ describe('install', () => {
5556
describe('_users views', () => {
5657
before(() => supertest(destination)
5758
.get('/_all_dbs')
59+
.set('cookie', adminSessionCookie)
5860
.set('Accept', 'application/json')
5961
.then((res) => {
6062
debug('res', res.body);
6163
expect(res.body).includes('_users', JSON.stringify(res.body));
6264
})
6365
.catch((err) => supertest(destination)
6466
.put('/_users')
67+
.set('cookie', adminSessionCookie)
6568
.set('Accept', 'application/json')
6669
.send({})
6770
));
@@ -102,15 +105,6 @@ describe('install', () => {
102105
});
103106

104107
describe('theuserscouch', () => {
105-
const usersDBname = config.usersDbConnection.dbname;
106-
before(() => supertest(destination)
107-
.get('/_all_dbs')
108-
.set('Accept', 'application/json')
109-
.then((res) => {
110-
debug('res', res.body);
111-
expect(res.body).includes('_users', JSON.stringify(res.body));
112-
}));
113-
114108
it('should replicate theuserscouch', () => supertest(destination)
115109
.post('/_replicate')
116110
.set('cookie', adminSessionCookie)
@@ -137,13 +131,6 @@ describe('install', () => {
137131
});
138132

139133
describe('new_corpus', () => {
140-
before(() => supertest(destination)
141-
.get('/_all_dbs')
142-
.set('Accept', 'application/json')
143-
.then((res) => {
144-
expect(res.body).includes('_users', JSON.stringify(res.body));
145-
}));
146-
147134
it('should replicate new_corpus', () => {
148135
const dbnameToReplicate = 'new_corpus';
149136

@@ -174,13 +161,6 @@ describe('install', () => {
174161
});
175162

176163
describe('new_testing_corpus', () => {
177-
before(() => supertest(destination)
178-
.get('/_all_dbs')
179-
.set('Accept', 'application/json')
180-
.then((res) => {
181-
expect(res.body).includes('_users', JSON.stringify(res.body));
182-
}));
183-
184164
it('should replicate new_testing_corpus', () => {
185165
const dbnameToReplicate = 'new_testing_corpus';
186166

@@ -337,50 +317,6 @@ describe('install', () => {
337317
});
338318

339319
describe('new_lexicon', () => {
340-
before(() => supertest(destination)
341-
.get('/_all_dbs')
342-
.set('Accept', 'application/json')
343-
.then((res) => {
344-
expect(res.body).includes('_users', JSON.stringify(res.body));
345-
}));
346-
347-
it('should replicate new_lexicon', () => {
348-
const dbnameToReplicate = 'new_lexicon';
349-
350-
return supertest(destination)
351-
.post('/_replicate')
352-
.set('cookie', adminSessionCookie)
353-
.set('Accept', 'application/json')
354-
.send({
355-
source: `${source}/${dbnameToReplicate}`,
356-
target: {
357-
url: `${destination}/${dbnameToReplicate}`,
358-
},
359-
create_target: true,
360-
})
361-
.then((res) => {
362-
debug('res.body new_lexicon', res.body);
363-
expect(res.body.ok).to.equal(true);
364-
365-
return supertest(destination)
366-
.get('/_all_dbs')
367-
.set('Accept', 'application/json');
368-
})
369-
.then((res) => {
370-
debug('res.body new_lexicon after', res.body);
371-
expect(res.body).includes(dbnameToReplicate);
372-
});
373-
});
374-
});
375-
376-
describe('new_lexicon', () => {
377-
before(() => supertest(destination)
378-
.get('/_all_dbs')
379-
.set('Accept', 'application/json')
380-
.then((res) => {
381-
expect(res.body).includes('_users', JSON.stringify(res.body));
382-
}));
383-
384320
it('should replicate new_lexicon', () => {
385321
const dbnameToReplicate = 'new_lexicon';
386322

0 commit comments

Comments
 (0)