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

Adding currency rate for the central bank of Iceland #494

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

olafurorng
Copy link

@olafurorng olafurorng commented Mar 26, 2020

Adding a new source for the currency endpoint: the currency rate from the Central Bank of Iceland.

Checklist

  • Write tests
  • Write documentation

@olafurorng
Copy link
Author

@olafurorng
Copy link
Author

@olafurorng
Copy link
Author

Comment on lines +21 to +27
const name = tds.eq(0).text()

if (name) {
currencies.push({
shortName: name,
longName: tds.eq(1).text(),
value: tds.eq(4).text(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the html has changed. The table only has 3 columns now so the indexes in the tds.eq calls are wrong.

Suggested change
const name = tds.eq(0).text()
if (name) {
currencies.push({
shortName: name,
longName: tds.eq(1).text(),
value: tds.eq(4).text(),
const name = tds.eq(1).text()
if (name) {
currencies.push({
shortName: name,
longName: tds.eq(0).text().trim(),
value: Number(tds.eq(2).text().replace(',', '.')),

I'm not sure if the if on line 23 is still valid now that name is from column index 1.

it('should return an array of objects containing correct fields', (done) => {
const params = helpers.testRequestParams('/currency/cb')
const resultHandler = helpers.testRequestHandlerForFields(done, fieldsToCheckFor)
request(params, resultHandler)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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