2019-02-10 18:49:48 -05:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-03-06 16:39:50 -05:00
|
|
|
import { test } from "../testing/mod.ts";
|
2019-03-06 19:42:24 -05:00
|
|
|
import { assertEquals } from "../testing/asserts.ts";
|
2019-02-10 18:49:48 -05:00
|
|
|
import { isFormFile } from "./formfile.ts";
|
|
|
|
|
2019-04-24 07:41:23 -04:00
|
|
|
test(function multipartIsFormFile(): void {
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(
|
2019-02-10 18:49:48 -05:00
|
|
|
isFormFile({
|
|
|
|
filename: "foo",
|
|
|
|
type: "application/json"
|
|
|
|
}),
|
|
|
|
true
|
|
|
|
);
|
2019-03-06 19:42:24 -05:00
|
|
|
assertEquals(
|
2019-02-10 18:49:48 -05:00
|
|
|
isFormFile({
|
|
|
|
filename: "foo"
|
|
|
|
}),
|
|
|
|
false
|
|
|
|
);
|
|
|
|
});
|
2019-09-03 03:10:05 -04:00
|
|
|
|
|
|
|
test(function isFormFileShouldNotThrow(): void {
|
|
|
|
assertEquals(
|
|
|
|
isFormFile({
|
|
|
|
filename: "foo",
|
|
|
|
type: "application/json",
|
|
|
|
hasOwnProperty: "bar"
|
|
|
|
}),
|
|
|
|
true
|
|
|
|
);
|
|
|
|
assertEquals(isFormFile(Object.create(null)), false);
|
|
|
|
});
|