mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-15 20:17:22 +00:00
Merge branch 'release/0.19' into feat/advanced-permissions
This commit is contained in:
@@ -6,13 +6,16 @@ describe("Api", async () => {
|
||||
it("should construct without options", () => {
|
||||
const api = new Api();
|
||||
expect(api.baseUrl).toBe("http://localhost");
|
||||
expect(api.isAuthVerified()).toBe(false);
|
||||
|
||||
// verified is true, because no token, user, headers or request given
|
||||
// therefore nothing to check, auth state is verified
|
||||
expect(api.isAuthVerified()).toBe(true);
|
||||
});
|
||||
|
||||
it("should ignore force verify if no claims given", () => {
|
||||
const api = new Api({ verified: true });
|
||||
expect(api.baseUrl).toBe("http://localhost");
|
||||
expect(api.isAuthVerified()).toBe(false);
|
||||
expect(api.isAuthVerified()).toBe(true);
|
||||
});
|
||||
|
||||
it("should construct from request (token)", async () => {
|
||||
|
||||
@@ -440,6 +440,35 @@ describe("Core Utils", async () => {
|
||||
height: 512,
|
||||
});
|
||||
});
|
||||
|
||||
test("isFileAccepted", () => {
|
||||
const file = new File([""], "file.txt", {
|
||||
type: "text/plain",
|
||||
});
|
||||
expect(utils.isFileAccepted(file, "text/plain")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, "text/plain,text/html")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, "text/html")).toBe(false);
|
||||
|
||||
{
|
||||
const file = new File([""], "file.jpg", {
|
||||
type: "image/jpeg",
|
||||
});
|
||||
expect(utils.isFileAccepted(file, "image/jpeg")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, "image/jpeg,image/png")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, "image/png")).toBe(false);
|
||||
expect(utils.isFileAccepted(file, "image/*")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, ".jpg")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, ".jpg,.png")).toBe(true);
|
||||
expect(utils.isFileAccepted(file, ".png")).toBe(false);
|
||||
}
|
||||
|
||||
{
|
||||
const file = new File([""], "file.png");
|
||||
expect(utils.isFileAccepted(file, undefined as any)).toBe(true);
|
||||
}
|
||||
|
||||
expect(() => utils.isFileAccepted(null as any, "text/plain")).toThrow();
|
||||
});
|
||||
});
|
||||
|
||||
describe("dates", () => {
|
||||
|
||||
Reference in New Issue
Block a user