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

add more databases to install #98

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 152 additions & 5 deletions test/integration/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,114 @@ describe('install', () => {
});
});

describe('new_gamify_corpus', () => {
before(() => supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json')
.then((res) => {
expect(res.body).includes('_users', JSON.stringify(res.body));
}));

it('should replicate new_gamify_corpus', () => {
const dbnameToReplicate = 'new_gamify_corpus';

return supertest(destination)
.post('/_replicate')
.set('Accept', 'application/json')
.send({
source: `${source}/${dbnameToReplicate}`,
target: {
url: `${destination}/${dbnameToReplicate}`,
},
create_target: true,
})
.then((res) => {
debug('res.body new_gamify_corpus', res.body);
expect(res.body.ok).to.equal(true);

return supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json');
})
.then((res) => {
debug('res.body new_gamify_corpus after', res.body);
expect(res.body).includes(dbnameToReplicate);
});
});
});

describe('new_learnx_corpus', () => {
before(() => supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json')
.then((res) => {
expect(res.body).includes('_users', JSON.stringify(res.body));
}));

it('should replicate new_learnx_corpus', () => {
const dbnameToReplicate = 'new_learnx_corpus';

return supertest(destination)
.post('/_replicate')
.set('Accept', 'application/json')
.send({
source: `${source}/${dbnameToReplicate}`,
target: {
url: `${destination}/${dbnameToReplicate}`,
},
create_target: true,
})
.then((res) => {
debug('res.body new_learnx_corpus', res.body);
expect(res.body.ok).to.equal(true);

return supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json');
})
.then((res) => {
debug('res.body new_learnx_corpus after', res.body);
expect(res.body).includes(dbnameToReplicate);
});
});
});

describe('new_wordcloud_corpus', () => {
before(() => supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json')
.then((res) => {
expect(res.body).includes('_users', JSON.stringify(res.body));
}));

it('should replicate new_wordcloud_corpus', () => {
const dbnameToReplicate = 'new_wordcloud_corpus';

return supertest(destination)
.post('/_replicate')
.set('Accept', 'application/json')
.send({
source: `${source}/${dbnameToReplicate}`,
target: {
url: `${destination}/${dbnameToReplicate}`,
},
create_target: true,
})
.then((res) => {
debug('res.body new_wordcloud_corpus', res.body);
expect(res.body.ok).to.equal(true);

return supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json');
})
.then((res) => {
debug('res.body new_wordcloud_corpus after', res.body);
expect(res.body).includes(dbnameToReplicate);
});
});
});

describe('new_testing_corpus', () => {
before(() => supertest(destination)
.get('/_all_dbs')
Expand Down Expand Up @@ -334,16 +442,16 @@ describe('install', () => {
});
});

describe('new_lexicon', () => {
describe('new_export', () => {
before(() => supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json')
.then((res) => {
expect(res.body).includes('_users', JSON.stringify(res.body));
}));

it('should replicate new_lexicon', () => {
const dbnameToReplicate = 'new_lexicon';
it('should replicate new_export', () => {
const dbnameToReplicate = 'new_export';

return supertest(destination)
.post('/_replicate')
Expand All @@ -356,17 +464,56 @@ describe('install', () => {
create_target: true,
})
.then((res) => {
debug('res.body new_lexicon', res.body);
debug('res.body new_export', res.body);
expect(res.body.ok).to.equal(true);

return supertest(destination)
.get('/_all_dbs')
.set('Accept', 'application/json');
})
.then((res) => {
debug('res.body new_lexicon after ', res.body);
debug('res.body new_export after ', res.body);
expect(res.body).includes(dbnameToReplicate);
});
});
});

describe('online prototype', () => {
/**
* note: unable to login and use the prototype because it is not using https in the docker container
* and the app expects and requires https
*/
it('should replicate prototype', () => {
const dbnameToReplicate = 'prototype';

return supertest(destination)
.post('/_replicate')
.set('Accept', 'application/json')
.send({
source: `${source}/${dbnameToReplicate}`,
target: {
url: `${destination}/${dbnameToReplicate}`,
},
create_target: true,
})
.then((res) => {
expect(res.body.ok).to.equal(true);

return supertest(destination)
.get(`/${dbnameToReplicate}/_design/prototype`)
.set('Accept', 'application/json');
})
.then((res) => {
debug('res.body prototype after ', res.body);
expect(res.body.couchapp && res.body.couchapp.name).to.equal('LingSync Prototype (has the most features of the apps)', JSON.stringify(res.body));

return supertest(destination)
.get(`/${dbnameToReplicate}/_design/prototype/user.html`);
})
.then((res) => {
debug('res.body prototype after ', res.body);
expect(res.status).to.equal(200);
});
});
});
});