Repository navigation
Fix/api urls - #996
Fix/api urls#996martimpassos wants to merge 4 commits into
Conversation
| it('returns the payload and the requested id', async () => { | ||
| let action | ||
|
|
||
| rsvp = async (a) => { |
There was a problem hiding this comment.
Use t.mock for mocks/spies instead
| expect(await res.json()).to.eql({ | ||
| project: '/tmp/current.tpy', | ||
| status: 'ok', | ||
| version: '1.0.0' |
There was a problem hiding this comment.
Probably best to use context.version as the expected value
| dispatch: () => {}, | ||
| log: { debug () {}, error () {} }, | ||
| resolveProject: (id) => resolveProject(id), | ||
| rsvp: (win, action) => rsvp(action), |
There was a problem hiding this comment.
Best use proper mocks/spies here instead of defining rsvp, resolveProject twice
inukshuk
left a comment
There was a problem hiding this comment.
Looks good! But let's use node-test mocks instead of rolling our own. You can either import from node:test or use the test/suite contexts (first argument passed to test/it)
|
Also it will be good to rebase this on It would be great to add a chain of tests (each one building on the next) like: starting with an empty project (incidentally, create a new project is probably an API call we're missing that could be useful?) import item/photo, add a tag, add a note, add a transcription, extract the photo. With the API using some of the internal commands now this actually makes the API a useful tool for integration testing stuff on a real project. |
Fixes a bug where API routes wouldn't match the encoded project id and adds minimal API tests.