-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: skip processing invalid body payload (#132)
* fix: fix processing invalid payload * fix: disable typecheck errors on lib
- Loading branch information
Showing
9 changed files
with
2,257 additions
and
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
name: Test | ||
|
||
on: [push] | ||
|
||
jobs: | ||
test: | ||
uses: snapshot-labs/actions/.github/workflows/test.yml@main | ||
secrets: inherit | ||
with: | ||
mysql_database_name: snapshot_relayer_test | ||
mysql_schema_path: ./src/schema.sql |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
.DS_Store | ||
node_modules | ||
dist | ||
build | ||
coverage | ||
|
||
# Remove some common IDE working directories | ||
.idea | ||
|
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,14 @@ | ||
export default { | ||
clearMocks: true, | ||
collectCoverage: true, | ||
collectCoverageFrom: ['./src/**'], | ||
coverageDirectory: 'coverage', | ||
coverageProvider: 'v8', | ||
coveragePathIgnorePatterns: ['/node_modules/', '<rootDir>/dist/', '<rootDir>/test/fixtures/'], | ||
preset: 'ts-jest', | ||
testEnvironment: 'jest-environment-node-single-context', | ||
setupFiles: ['dotenv/config'], | ||
moduleFileExtensions: ['js', 'ts'], | ||
testPathIgnorePatterns: ['dist/'], | ||
verbose: true | ||
}; |
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 @@ | ||
DATABASE_URL=mysql://root:[email protected]:3306/snapshot_relayer_test |
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,19 @@ | ||
import request from 'supertest'; | ||
|
||
const HOST = `http://localhost:${process.env.PORT || 3003}`; | ||
|
||
describe('POST /', () => { | ||
describe('when the request body is invalid', () => { | ||
const inputs: [string, any][] = [ | ||
['empty', {}], | ||
['missing the data key', { foo: 'bar' }], | ||
['missing the data.msg key', { data: { foo: 'bar' } }] | ||
]; | ||
|
||
it.each(inputs)('returns a 400 error when the input is %s', async (name, input) => { | ||
const response = await request(HOST).post('/').send(input); | ||
|
||
expect(response.statusCode).toBe(400); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.