mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
added format command and added trailing commas to reduce conflicts
This commit is contained in:
@@ -22,13 +22,13 @@ async function makeApp(mediaOverride: Partial<TAppMediaConfig> = {}) {
|
||||
adapter: {
|
||||
type: "local",
|
||||
config: {
|
||||
path: assetsTmpPath
|
||||
}
|
||||
}
|
||||
path: assetsTmpPath,
|
||||
},
|
||||
},
|
||||
},
|
||||
mediaOverride
|
||||
)
|
||||
}
|
||||
mediaOverride,
|
||||
),
|
||||
},
|
||||
});
|
||||
|
||||
await app.build();
|
||||
@@ -50,7 +50,7 @@ describe("MediaController", () => {
|
||||
const name = makeName("png");
|
||||
const res = await app.server.request("/api/media/upload/" + name, {
|
||||
method: "POST",
|
||||
body: file
|
||||
body: file,
|
||||
});
|
||||
const result = (await res.json()) as any;
|
||||
console.log(result);
|
||||
@@ -71,7 +71,7 @@ describe("MediaController", () => {
|
||||
|
||||
const res = await app.server.request("/api/media/upload/" + name, {
|
||||
method: "POST",
|
||||
body: form
|
||||
body: form,
|
||||
});
|
||||
const result = (await res.json()) as any;
|
||||
expect(result.name).toBe(name);
|
||||
@@ -88,7 +88,7 @@ describe("MediaController", () => {
|
||||
const name = makeName("png");
|
||||
const res = await app.server.request("/api/media/upload/" + name, {
|
||||
method: "POST",
|
||||
body: file
|
||||
body: file,
|
||||
});
|
||||
|
||||
expect(res.status).toBe(413);
|
||||
|
||||
@@ -60,7 +60,7 @@ describe("Storage", async () => {
|
||||
|
||||
test("uploads a file", async () => {
|
||||
const {
|
||||
meta: { type, size }
|
||||
meta: { type, size },
|
||||
} = await storage.uploadFile("hello", "world.txt");
|
||||
expect({ type, size }).toEqual({ type: "text/plain", size: 0 });
|
||||
});
|
||||
|
||||
@@ -14,7 +14,7 @@ test("what", async () => {
|
||||
const mf = new Miniflare({
|
||||
modules: true,
|
||||
script: "export default { async fetch() { return new Response(null); } }",
|
||||
r2Buckets: ["BUCKET"]
|
||||
r2Buckets: ["BUCKET"],
|
||||
});
|
||||
|
||||
const bucket = await mf.getR2Bucket("BUCKET");
|
||||
|
||||
@@ -8,7 +8,7 @@ const {
|
||||
CLOUDINARY_CLOUD_NAME,
|
||||
CLOUDINARY_API_KEY,
|
||||
CLOUDINARY_API_SECRET,
|
||||
CLOUDINARY_UPLOAD_PRESET
|
||||
CLOUDINARY_UPLOAD_PRESET,
|
||||
} = dotenvOutput.parsed!;
|
||||
|
||||
const ALL_TESTS = !!process.env.ALL_TESTS;
|
||||
@@ -20,7 +20,7 @@ describe.skipIf(ALL_TESTS)("StorageCloudinaryAdapter", () => {
|
||||
cloud_name: CLOUDINARY_CLOUD_NAME as string,
|
||||
api_key: CLOUDINARY_API_KEY as string,
|
||||
api_secret: CLOUDINARY_API_SECRET as string,
|
||||
upload_preset: CLOUDINARY_UPLOAD_PRESET as string
|
||||
upload_preset: CLOUDINARY_UPLOAD_PRESET as string,
|
||||
});
|
||||
|
||||
const file = Bun.file(`${import.meta.dir}/icon.png`);
|
||||
|
||||
@@ -5,7 +5,7 @@ import { assetsPath, assetsTmpPath } from "../../helper";
|
||||
|
||||
describe("StorageLocalAdapter", () => {
|
||||
const adapter = new StorageLocalAdapter({
|
||||
path: assetsTmpPath
|
||||
path: assetsTmpPath,
|
||||
});
|
||||
|
||||
const file = Bun.file(`${assetsPath}/image.png`);
|
||||
@@ -36,7 +36,7 @@ describe("StorageLocalAdapter", () => {
|
||||
test("gets object meta", async () => {
|
||||
expect(await adapter.getObjectMeta(filename)).toEqual({
|
||||
type: file.type, // image/png
|
||||
size: file.size
|
||||
size: file.size,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -20,17 +20,17 @@ describe.skipIf(true)("StorageS3Adapter", async () => {
|
||||
new StorageS3Adapter({
|
||||
access_key: R2_ACCESS_KEY as string,
|
||||
secret_access_key: R2_SECRET_ACCESS_KEY as string,
|
||||
url: R2_URL as string
|
||||
})
|
||||
url: R2_URL as string,
|
||||
}),
|
||||
],
|
||||
[
|
||||
"s3",
|
||||
new StorageS3Adapter({
|
||||
access_key: AWS_ACCESS_KEY as string,
|
||||
secret_access_key: AWS_SECRET_KEY as string,
|
||||
url: AWS_S3_URL as string
|
||||
})
|
||||
]
|
||||
url: AWS_S3_URL as string,
|
||||
}),
|
||||
],
|
||||
] as const;
|
||||
|
||||
const _conf = {
|
||||
@@ -41,8 +41,8 @@ describe.skipIf(true)("StorageS3Adapter", async () => {
|
||||
"objectExists",
|
||||
"getObject",
|
||||
"deleteObject",
|
||||
"getObjectMeta"
|
||||
]
|
||||
"getObjectMeta",
|
||||
],
|
||||
};
|
||||
|
||||
const file = Bun.file(`${import.meta.dir}/icon.png`);
|
||||
@@ -86,7 +86,7 @@ describe.skipIf(true)("StorageS3Adapter", async () => {
|
||||
test.skipIf(disabled("getObjectMeta"))("gets object meta", async () => {
|
||||
expect(await adapter.getObjectMeta(filename)).toEqual({
|
||||
type: file.type, // image/png
|
||||
size: file.size
|
||||
size: file.size,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -28,7 +28,7 @@ describe("media/mime-types", () => {
|
||||
exts,
|
||||
ext,
|
||||
expected: ex,
|
||||
actual: large.guessMimeType("." + ext)
|
||||
actual: large.guessMimeType("." + ext),
|
||||
});
|
||||
throw new Error(`Failed for ${ext}`);
|
||||
}
|
||||
@@ -49,13 +49,13 @@ describe("media/mime-types", () => {
|
||||
["image/gif", true],
|
||||
["whatever", false],
|
||||
["text/tab-separated-values", true],
|
||||
["application/zip", true]
|
||||
["application/zip", true],
|
||||
];
|
||||
|
||||
for (const [mime, expected, exclude] of tests) {
|
||||
expect(
|
||||
tiny.isMimeType(mime, exclude as any),
|
||||
`isMimeType(): ${mime} should be ${expected}`
|
||||
`isMimeType(): ${mime} should be ${expected}`,
|
||||
).toBe(expected as any);
|
||||
}
|
||||
});
|
||||
@@ -68,7 +68,7 @@ describe("media/mime-types", () => {
|
||||
["image/jpeg", "jpeg"],
|
||||
["application/zip", "zip"],
|
||||
["text/tab-separated-values", "tsv"],
|
||||
["application/zip", "zip"]
|
||||
["application/zip", "zip"],
|
||||
];
|
||||
|
||||
for (const [mime, ext] of tests) {
|
||||
@@ -85,13 +85,13 @@ describe("media/mime-types", () => {
|
||||
["image.heic", "heic"],
|
||||
["image.jpeg", "jpeg"],
|
||||
["-473Wx593H-466453554-black-MODEL.jpg", "jpg"],
|
||||
["-473Wx593H-466453554-black-MODEL.avif", "avif"]
|
||||
["-473Wx593H-466453554-black-MODEL.avif", "avif"],
|
||||
];
|
||||
|
||||
for (const [filename, ext] of tests) {
|
||||
expect(
|
||||
getRandomizedFilename(filename).split(".").pop(),
|
||||
`getRandomizedFilename(): ${filename} should end with ${ext}`
|
||||
`getRandomizedFilename(): ${filename} should end with ${ext}`,
|
||||
).toBe(ext);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user