Skip to content

Commit

Permalink
remove todos, move import
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Nov 16, 2023
1 parent 0c4bcb1 commit a1ce4fc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions api_tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"@types/node": "^20.9.0",
"@typescript-eslint/eslint-plugin": "^6.10.0",
"@typescript-eslint/parser": "^6.10.0",
"download-file-sync": "^1.0.4",
"eslint": "^8.53.0",
"eslint-plugin-prettier": "^5.0.1",
"jest": "^29.5.0",
"lemmy-js-client": "0.19.0-alpha.18",
"prettier": "^3.0.0",
"ts-jest": "^29.1.0",
"typescript": "^5.0.4",
"download-file-sync": "^1.0.4"
"typescript": "^5.0.4"
}
}
6 changes: 2 additions & 4 deletions api_tests/src/image.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ jest.setTimeout(120000);
import { UploadImage, DeleteImage } from "lemmy-js-client";
import { alpha, setupLogins, unfollowRemotes } from "./shared";
import fs = require("fs");
const downloadFileSync = require("download-file-sync");

beforeAll(setupLogins);

Expand All @@ -12,7 +13,6 @@ afterAll(() => {

test("Upload image and delete it", async () => {
// upload test image
// TODO: this doesnt require separate auth anymore (same for delete)
const upload_image = fs.readFileSync("test.png");
const upload_form: UploadImage = {
image: upload_image,
Expand All @@ -25,7 +25,6 @@ test("Upload image and delete it", async () => {
expect(upload.delete_url).toBeDefined();

// ensure that image download is working. theres probably a better way to do this
const downloadFileSync = require("download-file-sync");
const content = downloadFileSync(upload.url);
expect(content.length).toBeGreaterThan(0);

Expand All @@ -34,9 +33,8 @@ test("Upload image and delete it", async () => {
token: upload.files![0].delete_token,
filename: upload.files![0].file,
};
// TODO: throws `FetchError: Invalid response body while trying to fetch http://127.0.0.1:8541/pictrs/image/delete/37095c51-b315-42ab-b7a2-86a299f3d913/3e273850-12b4-4fe4-86c6-a35990d2c5df.png: Parse Error: Expected HTTP/`
const delete_ = await alpha.deleteImage(delete_form);
console.log(delete_);
expect(delete_).toBe(true);

// ensure that image is deleted
const content2 = downloadFileSync(upload.url);
Expand Down

0 comments on commit a1ce4fc

Please sign in to comment.