summaryrefslogtreecommitdiff
path: root/std/multipart/formfile_test.ts
blob: cc46168fb207d20c70a918a44213e80fcb117ff1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { test } from "../testing/mod.ts";
import { assertEquals } from "../testing/asserts.ts";
import { isFormFile } from "./formfile.ts";

test(function multipartIsFormFile(): void {
  assertEquals(
    isFormFile({
      filename: "foo",
      type: "application/json"
    }),
    true
  );
  assertEquals(
    isFormFile({
      filename: "foo"
    }),
    false
  );
});

test(function isFormFileShouldNotThrow(): void {
  assertEquals(
    isFormFile({
      filename: "foo",
      type: "application/json",
      hasOwnProperty: "bar"
    }),
    true
  );
  assertEquals(isFormFile(Object.create(null)), false);
});