add is.formData
This commit is contained in:
parent
b007935b4b
commit
c6eac3ebd4
2 changed files with 25 additions and 0 deletions
21
test/test.ts
21
test/test.ts
|
|
@ -1621,6 +1621,27 @@ test('is.all', t => {
|
|||
});
|
||||
});
|
||||
|
||||
test('is.formData', t => {
|
||||
const data = new window.FormData();
|
||||
t.true(is.formData(data));
|
||||
t.false(is.formData({}));
|
||||
t.false(is.formData(undefined));
|
||||
t.false(is.formData(null));
|
||||
|
||||
t.notThrows(() => {
|
||||
assert.formData(data);
|
||||
});
|
||||
t.throws(() => {
|
||||
assert.formData({});
|
||||
});
|
||||
t.throws(() => {
|
||||
assert.formData(undefined);
|
||||
});
|
||||
t.throws(() => {
|
||||
assert.formData(null);
|
||||
});
|
||||
});
|
||||
|
||||
test('assert', t => {
|
||||
// Contrived test showing that TypeScript acknowledges the type assertion in `assert.number()`.
|
||||
// Real--world usage includes asserting user input, but here we use a random number/string generator.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue