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

fix: show manuscripts for doi if returned #1288

Merged
merged 2 commits into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/components/found-manuscripts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export default class FoundManuscriptsComponent extends Component {
const foundOAMss = yield this.oaManuscriptService.lookup(doi);

if (foundOAMss) {
this.foundManuscripts.push(foundOAMss);
this.foundManuscripts = [...foundOAMss];
}
};
}
4 changes: 2 additions & 2 deletions app/services/oa-manuscript-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class OAManuscriptService extends Service {
console.assert(!!doi, '%cNo DOI was provided to the manuscript service lookup.', 'color: red;');

if (!this.lookUpPath || !doi) {
return;
return [];
}

const url = `${this.lookUpPath}?doi=${doi}`;
Expand All @@ -38,7 +38,7 @@ export default class OAManuscriptService extends Service {
.then((resp) => {
if (resp.status !== 200) {
console.log(`%cFailed to lookup files for DOI (${doi}). Reason: "${resp.message}"`, 'color: red;');
return {};
return [];
}
return resp.json();
})
Expand Down
10 changes: 6 additions & 4 deletions tests/integration/components/found-manuscripts/component-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,12 @@ module('Integration | Component | found-manuscripts', (hooks) => {
const mockMsService = Service.extend({
lookup(doi) {
assert.ok(doi, 'DOI needs to be present');
return Promise.resolve({
name: 'This is a moo',
url: 'http://moo.example.com',
});
return Promise.resolve([
{
name: 'This is a moo',
url: 'http://moo.example.com',
},
]);
},
});

Expand Down
Loading