Skip to content

Commit

Permalink
fix: 🐛 refactor volume tests to be compatible w/ strictNullChecks
Browse files Browse the repository at this point in the history
  • Loading branch information
G-Rath committed Jul 13, 2019
1 parent 5a6624f commit f02fbac
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/__tests__/volume.test.ts
Expand Up @@ -342,7 +342,7 @@ describe('volume', () => {
});
it('Error on file not found', done => {
vol.open('/non-existing-file.txt', 'r', (err, fd) => {
expect(err.code).toBe('ENOENT');
expect(err).toHaveProperty('code', 'ENOENT');
done();
});
});
Expand Down Expand Up @@ -395,7 +395,7 @@ describe('volume', () => {
});
it('Error on incorrect flags for directory', done => {
vol.open('/test-dir', 'r+', (err, fd) => {
expect(err.code).toBe('EISDIR');
expect(err).toHaveProperty('code', 'EISDIR');
done();
});
});
Expand All @@ -412,7 +412,7 @@ describe('volume', () => {
it('Closes file without errors', done => {
vol.open('/test.txt', 'w', (err, fd) => {
expect(err).toBe(null);
vol.close(fd, err => {
vol.close(fd || -1, err => {
expect(err).toBe(null);
done();
});
Expand Down Expand Up @@ -547,7 +547,7 @@ describe('volume', () => {
});
it('Throws error when no callback provided', () => {
try {
vol.writeFile('/asdf.txt', 'asdf', 'utf8', undefined);
vol.writeFile('/asdf.txt', 'asdf', 'utf8', undefined as any);
throw Error('This should not throw');
} catch (err) {
expect(err.message).toBe('callback must be a function');
Expand Down

0 comments on commit f02fbac

Please sign in to comment.