-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: setup test env and add some basic test to implement
- Loading branch information
Showing
7 changed files
with
2,231 additions
and
28 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,27 @@ | ||
name: Build and run tests | ||
on: [push] | ||
jobs: | ||
build-test: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
DATABASE_URL: 'mysql://root:[email protected]:3306/hub_test' | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
cache: 'yarn' | ||
- name: Set up MySQL | ||
run: | | ||
sudo /etc/init.d/mysql start | ||
mysql -e 'CREATE DATABASE hub_test;' -uroot -proot | ||
mysql -uroot -proot hub_test < src/helpers/schema.sql | ||
mysql -uroot -proot -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';" | ||
mysql -uroot -proot -e "FLUSH PRIVILEGES;" | ||
- run: yarn | ||
- run: yarn build | ||
- run: yarn test | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} |
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,22 @@ | ||
/* | ||
* For a detailed explanation regarding each configuration property and type check, visit: | ||
* https://jestjs.io/docs/configuration | ||
*/ | ||
|
||
export default { | ||
clearMocks: true, | ||
collectCoverage: true, | ||
collectCoverageFrom: ['./src/**'], | ||
coverageDirectory: 'coverage', | ||
coverageProvider: 'v8', | ||
|
||
// An array of regexp pattern strings used to skip coverage collection | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DATABASE_URL=mysql://root:[email protected]:3306/hub_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,3 @@ | ||
describe('GET /graphql', () => { | ||
it.todo('exposes a graphql endpoint'); | ||
}); |
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 @@ | ||
describe('GET /api/space/:key', () => { | ||
describe('when the space exists', () => { | ||
it.todo('returns a space object'); | ||
}); | ||
|
||
describe('when the space does not exist', () => { | ||
it.todo('returns a 404 error'); | ||
}); | ||
}); |
Oops, something went wrong.