This repository has been archived by the owner on Oct 7, 2024. It is now read-only.
generated from MetaMask/metamask-module-template
-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: add bundler url validation * fix: update BundlerUrl validation * fix: lint * fix: update EthBaseUserOperationStruct test to use a baseUserOp * fix: update url struct
- Loading branch information
1 parent
a95c7f9
commit 2164741
Showing
4 changed files
with
107 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { UrlStruct } from '../superstruct'; | ||
|
||
describe('types', () => { | ||
it('is a valid BundlerUrl', () => { | ||
const url = 'https://api.example.com'; | ||
expect(() => UrlStruct.assert(url)).not.toThrow(); | ||
}); | ||
|
||
it('is a valid BundlerUrl with query parameters', () => { | ||
const url = 'https://api.example.com?foo=bar'; | ||
expect(() => UrlStruct.assert(url)).not.toThrow(); | ||
}); | ||
|
||
it('accepts path parameters', () => { | ||
const url = 'https://api.example.com/foo/bar'; | ||
expect(() => UrlStruct.assert(url)).not.toThrow(); | ||
}); | ||
|
||
it('fails if it does not start with http or https', () => { | ||
const url = 'ftp://api.example.com'; | ||
expect(() => UrlStruct.assert(url)).toThrow( | ||
'Expected a value of type `Url`, but received: `"ftp://api.example.com"`', | ||
); | ||
}); | ||
|
||
it('has to start with http or https', () => { | ||
const url = 'http://api.example.com'; | ||
expect(() => UrlStruct.assert(url)).not.toThrow(); | ||
}); | ||
}); |
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