Skip to content

Commit

Permalink
basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed Oct 16, 2023
1 parent f4860b8 commit 7ceee88
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions apps/meteor/tests/end-to-end/api/20-licenses.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,50 @@ describe('licenses', function () {
});
});

describe('[/licenses.info]', () => {
it('should fail if not logged in', (done) => {
request
.get(api('licenses.info'))
.expect('Content-Type', 'application/json')
.expect(401)
.expect((res) => {
expect(res.body).to.have.property('status', 'error');
expect(res.body).to.have.property('message');
})
.end(done);
});

it('should return limited information if user is unauthorized', (done) => {
request
.get(api('licenses.info'))
.set(unauthorizedUserCredentials)
.expect('Content-Type', 'application/json')
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('data').and.to.be.an('object');
expect(res.body.data).to.not.have.property('license');
expect(res.body.data).to.have.property('tags').and.to.be.an('array');
})
.end(done);
});

it('should return unrestricted info if user is logged in and is authorized', (done) => {
request
.get(api('licenses.info'))
.set(credentials)
.expect(200)
.expect((res) => {
expect(res.body).to.have.property('success', true);
expect(res.body).to.have.property('data').and.to.be.an('object');
expect(res.body.data).to.have.property('license').and.to.be.an('object');
expect(res.body.data).to.have.property('tags').and.to.be.an('array');
})

.end(done);
});
});

describe('[/licenses.isEnterprise]', () => {
it('should fail if not logged in', (done) => {
request
Expand Down

0 comments on commit 7ceee88

Please sign in to comment.