- some of the existing tests return `items` as an empty array
- the upcoming change to switch `mailgun-js` to `mailgun.js` means it's
more strict about requiring `paging` too
- this commit adds a new empty-response fixture so we can standardize
using that across tests
- because of how the npm scripts were set up, we were running the full
Admin integration tests during the unit tests phase of CI
- this commit renames the majority of `test` to `test:unit` in the
package.json files, and aliases `test` to `test:unit`
- special packages like Admin have no-op'd `test:unit` scripts so we
don't end up running its tests
- when I extracted `mailgun-client` to a separate package, I
accidentally removed the lazyloading for the `mailgun-js` library,
which takes a non-negligible amount of time to require on boot
- this fixes that by moving the require into the function where it's
used
- this is the current functionality of the code, as it has always been,
but this test ensures we prioritise the values in the config over
those in settings
- even though we don't do anything yet, the code was calling `.length`
on an object, which is `undefined`
- this fixes that by checking the length of the keys
- also moves the code block down so we can early-return if mailgun is
not configured
refs https://github.com/TryGhost/Toolbox/issues/363
- this copies over tests from `email-analytics-provider-mailgun` that
are more relevant here
- there is now duplication in tests across the two packages but this
will be resolved soon
- this test checks that the mailgun client respects the changes in
settings, which is something that we used to ask
`email-analytics-provider-mailgun` to do when the mailgun client was
made in that package
- since then, we've pulled it out, so we should move the test to the
`mailgun-client` library
refs https://github.com/TryGhost/Toolbox/issues/363
- this commit pulls all code involving the Mailgun client SDK into one
new package called `mailgun-client`
- this means we should be able to replace `mailgun-js` (deprecated) with
`mailgun.js` (the new, official one) without editing code all over the
place
- this also lays some groundwork for better testing of smaller
components