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

Exporter cleanup & tests #6596

Merged
merged 1 commit into from Mar 13, 2016
Merged

Exporter cleanup & tests #6596

merged 1 commit into from Mar 13, 2016

Conversation

ErisDS
Copy link
Member

@ErisDS ErisDS commented Mar 12, 2016

This is a small cleanup / refactor which is a precursor to a bigger one for migrations. Doing this adds some ground work for testing other bits and pieces in migrations.

The main piece, other than the cleanup of the export code, is the change to the knex getter - setting configurable to be true rather than false, otherwise it is not possible to stub this method. IMO testability is more important here.

Two other changes are present:

  • client trusted domains has been added to export exclude list as clients are already there
  • two paths have been removed from the config, I am not sure that these have ever been used!

refs #6301

  • change knex getter def to be configurable, else it is not testable
  • remove exportPath and lang from config - neither are used
  • add client_trusted_domains to tables which shouldn't be exported as there are no clients in the export
  • change export signature to be an object with doExport function consistent with import & easier to test
  • cleanup export code so it is clearer, easier to read & to test:
    • use mapSeries instead of sequence
    • use Promise.props instead of Promise.join
    • split functionality into smaller functions
  • add test coverage

refs TryGhost#6301

- change knex getter def to be configurable, else it is not testable
- remove exportPath and lang from config - neither are used
- add client_trusted_domains to tables which shouldn't be exported as there are no clients in the export
- change export signature to be an object with `doExport` function consistent with import & easier to test
- cleanup export code so it is clearer, easier to read & to test:
  - use mapSeries instead of sequence
  - use Promise.props instead of Promise.join
  - split functionality into smaller functions
- add test coverage
jaswilli added a commit that referenced this pull request Mar 13, 2016
@jaswilli jaswilli merged commit 39dfb2c into TryGhost:master Mar 13, 2016
@ErisDS ErisDS deleted the export-clean branch March 24, 2016 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants