-
Notifications
You must be signed in to change notification settings - Fork 0
#46: Remove API tokens from Git (closes #46) #48
Conversation
The ContactHub API token, workspaceId and nodeId used by the e2e tests must now be set in three env variables. I also moved the shared `randomString()` method to the new `helper.js` file.
Some tests were relying on specific data already being present in the workspace. I also had to increase the timeouts in a few places because the API is slower than usual. Hopefully this can be reverted if the API performance improves.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good 💯
Just a few comments left
return c.base && c.base.contacts && c.base.contacts.email; | ||
}); | ||
|
||
expect(first && second && first > second).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you checking first > second
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To test they are reverse-sorted by email address, e.g. I expect zzzz@example.com to appear first than xxxx@example.com
README.md
Outdated
```sh | ||
export CONTACTHUB_TEST_TOKEN="..." | ||
export CONTACTHUB_TEST_WORKSPACE="..." | ||
export CONTACTHUB_TEST_NODE="..." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONTACTHUB_TEST_WORKSPACE_ID
and CONTACTHUB_TEST_NODE_ID
or even better CH_TEST_WORKSPACE_ID
and CH_TEST_NODE_ID
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it but was kind of annoyed by having an additional _
:)
It's probably better, anyway, I'll add it. The short version is a bit more obscure if you look at your vars in env
and don't remember what CH
was about, I'll use the long version.
test/e2e/helper.js
Outdated
|
||
const tok = process.env.CONTACTHUB_TEST_TOKEN; | ||
const wid = process.env.CONTACTHUB_TEST_WORKSPACE; | ||
const nid = process.env.CONTACTHUB_TEST_NODE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
test/e2e/helper.js
Outdated
} | ||
|
||
return new ContactHub({ | ||
token: tok, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you name tok
var to token
you can use the short form here (also for workspaceId
, nodeId
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True, I'll change it.
Issue #46
Test Plan
tests performed
After setting the new env vars:
✅
npm run e2e
tests not performed (domain coverage)