-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for FormDataLike and FileLike compatibility
- Loading branch information
1 parent
29a58a0
commit b0cb2bd
Showing
7 changed files
with
135 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import test from "ava" | ||
|
||
import {expectType} from "ts-expect" | ||
import {File as FormDataNodeFile} from "formdata-node" | ||
import {File as NodeFetchFile} from "node-fetch" | ||
import {File as UndiciFile} from "undici" | ||
|
||
import type {FileLike} from "./FileLike.js" | ||
|
||
test("File is assignable to FileLike", t => { | ||
expectType<FileLike>(new File([], "test.txt")) | ||
|
||
t.pass() | ||
}) | ||
|
||
test("File from formdata-node is assignable to FileLike", t => { | ||
expectType<FileLike>(new FormDataNodeFile([], "test.txt")) | ||
|
||
t.pass() | ||
}) | ||
|
||
test("File from undici is assignable to FileLike", t => { | ||
expectType<FileLike>(new UndiciFile([], "test.txt")) | ||
|
||
t.pass() | ||
}) | ||
|
||
test("File from node-fetch is assignable to FileLike", t => { | ||
expectType<FileLike>(new NodeFetchFile([], "test.txt")) | ||
|
||
t.pass() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import test from "ava" | ||
|
||
import {expectType} from "ts-expect" | ||
import {FormData as FormDataNode} from "formdata-node" | ||
import {FormData as NodeFetchFormData} from "node-fetch" | ||
import {FormData as UndiciFormData} from "undici" | ||
|
||
import type {FormDataLike} from "./FormDataLike.js" | ||
|
||
test("FormData is assignable to FormDataLike", t => { | ||
expectType<FormDataLike>(new FormData()) | ||
|
||
t.pass() | ||
}) | ||
|
||
test("FormData from formdata-node is assignable to FormDataLike", t => { | ||
expectType<FormDataLike>(new FormDataNode()) | ||
|
||
t.pass() | ||
}) | ||
|
||
test("FormData from undici is assignable to FormDataLike", t => { | ||
expectType<FormDataLike>(new UndiciFormData()) | ||
|
||
t.pass() | ||
}) | ||
|
||
test("FormData from node-fetch is assignable to FormDataLike", t => { | ||
expectType<FormDataLike>(new NodeFetchFormData()) | ||
|
||
t.pass() | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters