Skip to content

Commit

Permalink
feat(constructor and base url): Adds a flag to the constructor that a…
Browse files Browse the repository at this point in the history
…llows for use of custom domains

re #6
  • Loading branch information
noahbjohnson committed Oct 1, 2019
1 parent 701e60b commit 51452f3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/tw.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ describe('#teamwork', function () {
delete process.env.TW_API
})

it('throws an error when an invalid custom domain is passed', function () {
expect(() => tw(api, 'mycompany.com', true)).to.throw(Error, 'custom domains must be fully qualified and include protocol without a trailing slash')
})

it('throws an error when a custom domain with no protocol', function () {
expect(() => tw(api, 'tw.mycompany.com', true)).to.throw(Error, 'custom domains must be fully qualified and include protocol without a trailing slash')
})

// Success
//
it('returns the default teamwork class', function () {
Expand All @@ -79,6 +87,11 @@ describe('#teamwork', function () {
delete process.env.TW_SUB
})

it('returns the default teamwork class when a custom domain is used', function () {
const instance = tw(api, 'https://projects.mydomain.net', true)
expect(instance).to.be.an.instanceof(teamwork)
})

it('returns correct Class instance when called', function () {
const instance = tw(api, domain)

Expand Down

0 comments on commit 51452f3

Please sign in to comment.