-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use TypeScript; update deps; refactor exports
* **(BREAKING)** Change `index` so that it exports all public modules as named exports * **(BREAKING)** Update all dependencies so that we get TypeScript versions * Convert implementation code to TypeScript * Convert tests to TypeScript, and add tests to ensure that the JavaScript-only checks still work for as much backward compatibility as possible * Add a working TypeDoc configuration file in the event that we want to generate documentation
- Loading branch information
Showing
20 changed files
with
990 additions
and
624 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
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
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,39 @@ | ||
const { createInfuraMiddleware } = require('.'); | ||
|
||
describe('createInfuraMiddleware (JS-only tests)', () => { | ||
it('throws when the projectId is a number', () => { | ||
expect(() => createInfuraMiddleware({ projectId: 42 })).toThrow( | ||
/Invalid value for 'projectId'/u, | ||
); | ||
}); | ||
|
||
it('throws when the projectId is undefined', () => { | ||
expect(() => createInfuraMiddleware({ projectId: undefined })).toThrow( | ||
/Invalid value for 'projectId'/u, | ||
); | ||
}); | ||
|
||
it('throws when the projectId is null', () => { | ||
expect(() => createInfuraMiddleware({ projectId: null })).toThrow( | ||
/Invalid value for 'projectId'/u, | ||
); | ||
}); | ||
|
||
it('throws when headers is null', () => { | ||
expect(() => | ||
createInfuraMiddleware({ projectId: 'foo', headers: null }), | ||
).toThrow(/Invalid value for 'headers'/u); | ||
}); | ||
|
||
it('throws when headers is a number', () => { | ||
expect(() => | ||
createInfuraMiddleware({ projectId: 'foo', headers: 42 }), | ||
).toThrow(/Invalid value for 'headers'/u); | ||
}); | ||
|
||
it('throws when headers is an empty string', () => { | ||
expect(() => | ||
createInfuraMiddleware({ projectId: 'foo', headers: '' }), | ||
).toThrow(/Invalid value for 'headers'/u); | ||
}); | ||
}); |
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,9 @@ | ||
import { createInfuraMiddleware } from '.'; | ||
|
||
describe('createInfuraMiddleware', () => { | ||
it('throws when the projectId is an empty string', () => { | ||
expect(() => createInfuraMiddleware({ projectId: '' })).toThrow( | ||
/Invalid value for 'projectId'/u, | ||
); | ||
}); | ||
}); |
Oops, something went wrong.