Skip to content

Commit e2cefec

Browse files
committed
ava-ify
1 parent 2c9e73d commit e2cefec

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

file.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class File extends Blob {
1111
*/ // @ts-ignore
1212
constructor(fileBits, fileName, options = {}) {
1313
if (arguments.length < 2) {
14-
throw new TypeError(`Failed to construct 'File': 2 arguments required`);
14+
throw new TypeError(`Failed to construct 'File': 2 arguments required.`);
1515
}
1616
super(fileBits, options);
1717

test.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ if (buffer.Blob) {
273273
}
274274

275275
test('File is a instance of blob', t => {
276-
t.is(new File([], '') instanceof Blob, true);
276+
t.true(new File([], '') instanceof Blob);
277277
});
278278

279279
test('fileFrom returns the name', async t => {
@@ -302,7 +302,7 @@ test('fileFrom(path, type) read/sets the lastModified ', async t => {
302302
// Earlier test updates the last modified date to now
303303
t.is(typeof file.lastModified, 'number');
304304
// The lastModifiedDate is deprecated and removed from spec
305-
t.is('lastModifiedDate' in file, false);
305+
t.false('lastModifiedDate' in file);
306306
t.is(file.lastModified > Date.now() - 60000, true);
307307
});
308308

@@ -317,9 +317,8 @@ test('blobFrom(path) sets empty type', async t => {
317317
});
318318

319319
test('new File() throws with too few args', t => {
320-
try {
321-
const file = new File(); // eslint-disable-line no-unused-vars
322-
} catch (error) {
323-
t.is(error.constructor.name, 'TypeError');
324-
}
320+
t.throws(() => new File(), {
321+
instanceOf: TypeError,
322+
message: 'Failed to construct \'File\': 2 arguments required.'
323+
});
325324
});

0 commit comments

Comments
 (0)