-
Notifications
You must be signed in to change notification settings - Fork 64
[WIP] Add package tracking history from postur.is #348
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
Conversation
I'm not gonna add the package metadata or write documentation in this PR. |
LGTM |
Need to merge #376 before this codeship test will pass. |
|
||
describe('tracking', () => { | ||
it('should return a 404 when the tracking number can\'t be found', (done) => { | ||
request.get('http://localhost:3101/tracking/derp', (error, response) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Mock the test
import assert from 'assert' | ||
|
||
describe('tracking', () => { | ||
it('should return a 404 when the tracking number can\'t be found', (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add a test for when tracking actually works
endpoints/tracking/index.js
Outdated
import cheerio from 'cheerio' | ||
import app from '../../server' | ||
|
||
app.get('/tracking/:trackingNumber', (req, res) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is /tracking
maybe too general?
endpoints/tracking/index.js
Outdated
return res.status(404).json({}) | ||
} | ||
|
||
return res.json({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cache it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering how long tho. Presumably people would want to know the status of their package right now? Maybe a cache of a minute would help if we are getting bombarded with requests tho?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd say any caching is good. 1 minute sounds good. We can always tweak it later if we feel the need.
I had a bunch of issues running the tests for this. Waiting on #380 to land so I can run the test in isolation and have speedier debugging. There might be more PRs in the meantime to get this even better. |
4a5296b
to
ab4fed1
Compare
This and basically any new endpoint needs a better way on how to mock the data sources and not mock the |
I've started this in #403. |
ab4fed1
to
e519903
Compare
It seeeeems like postur.is is now a client side thing and thus you can just get the data from this handy URL That kind of makes this endpoint hard to develop and useless! 😸 |
New endpoint to track package coming to Iceland, using postur.is as a datasource.
Checklist