-
-
Notifications
You must be signed in to change notification settings - Fork 884
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
Add api tests for image endpoints #4150
Conversation
api_tests/src/images.spec.ts
Outdated
expect(upload.delete_url).toBeDefined(); | ||
|
||
// ensure that image download is working. theres probably a better way to do this | ||
var downloadFileSync = require('download-file-sync'); |
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.
Any reason you're importing this with require
inside this test instead of importing it at the top like the rest of the dependencies?
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.
If I move it to the other imports at the top it throws error TS7016: Could not find a declaration file for module 'download-file-sync'
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.
That shouldn't be a breaking error, but you can also probably do yarn add -D @types/download-file-sync
api_tests/src/images.spec.ts
Outdated
let upload_image = fs.readFileSync("test.png"); | ||
let upload_form: UploadImage = { | ||
image: upload_image, | ||
auth: undefined, |
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.
Probably needs the alpha auth.
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.
The upload is successful, only delete fails. Anyway there is no reason to pass separate auth tokens for these calls anymore, as image endpoints use the same cookie/header auth as all other api endpoints.
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.
0.19.0-alpha.17
is deployed now, and it should have that.
Btw with
|
That's due to LemmyNet/lemmy-js-client#207 . The fix would be to compare |
Its passing now! |
a5ae746
to
a1ce4fc
Compare
Im starting to add some test cases for image endpoints to ensure that they are working properly (and keep working in the future). The code is rather messy because Im not familiar with js/ts, improvement suggestions welcome.
cc @SleeplessOne1917 @asonix