From 86f3fc3c519b957ec00e60f9709dc743815e4290 Mon Sep 17 00:00:00 2001 From: Jared Galanis Date: Fri, 13 Oct 2023 09:49:48 -0400 Subject: [PATCH] fix: add better policy step tests (#1224) * fix: add better policy step tests * fix tests - the factories are filling in data where the fixtures are silent, so the pmcParticipation field on journal was being filled in as A by default. - we should be explicit when creating the journal via the type in method in the journal field in the acceptance tests to pass in pmcPartificpation method * lol name the test file correctly * make the journal test real --- app/components/policy-card/index.hbs | 27 ++--- app/components/workflow-policies/index.hbs | 2 +- app/models/journal.js | 6 +- app/models/policy.js | 1 - mirage/config.js | 3 + mirage/factories/journal.js | 11 ++ mirage/factories/policy.js | 11 ++ mirage/factories/publication.js | 12 ++ mirage/factories/repository.js | 13 +++ mirage/factories/submission.js | 14 +++ package.json | 2 +- tests/acceptance/nih-submission-test.js | 1 + .../components/policy-card-test.js | 105 ++++++++++++------ .../components/workflow-policies-test.js | 60 ++++++++-- tests/unit/models/journal-test.js | 22 ++++ tests/unit/models/journal.js | 12 -- yarn.lock | 10 +- 17 files changed, 223 insertions(+), 89 deletions(-) create mode 100644 mirage/factories/journal.js create mode 100644 mirage/factories/policy.js create mode 100644 mirage/factories/publication.js create mode 100644 mirage/factories/repository.js create mode 100644 mirage/factories/submission.js create mode 100644 tests/unit/models/journal-test.js delete mode 100644 tests/unit/models/journal.js diff --git a/app/components/policy-card/index.hbs b/app/components/policy-card/index.hbs index 2ae30a7c4..5779072de 100644 --- a/app/components/policy-card/index.hbs +++ b/app/components/policy-card/index.hbs @@ -1,36 +1,31 @@ {{! template-lint-disable link-rel-noopener no-action no-triple-curlies require-input-label }}
+

+ + {{@policy.title}} + +

{{#if this.policyIsJHU}} -

- - {{@policy.title}} - -

-
+
Expects deposit into an open access repository
{{else}} -

- - {{@policy.title}} - -

-
+
Requires deposit into {{#each @policy.repositories as |repo index|}} {{if index ", "}}{{repo.name}} {{/each}}
{{/if}} -

+

{{{@policy.description}}} {{#if @policy.policyUrl}}

For more information, see their official policy below.
- + {{@policy.policyUrl}} {{/if}} @@ -38,7 +33,7 @@
{{#if this.usesPmcRepository}} {{#if this.methodAJournal}} -

+
The journal you published in participates in the PMC Method A program, and will submit the published article to PMC on your behalf. @@ -47,7 +42,7 @@
{{else}} -
+

Some journals would submit your article to PMC on your behalf, for a fee. Specific arrangements would be required. Please indicate below whether or not you have made an arrangement with the publisher to have diff --git a/app/components/workflow-policies/index.hbs b/app/components/workflow-policies/index.hbs index a9a86bc84..aea723841 100644 --- a/app/components/workflow-policies/index.hbs +++ b/app/components/workflow-policies/index.hbs @@ -11,7 +11,7 @@ -