-
-
Notifications
You must be signed in to change notification settings - Fork 379
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91d0a45
commit bf63f56
Showing
10 changed files
with
1,945 additions
and
26 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,6 @@ | ||
STORE_ACCESS_KEY=minio | ||
STORE_SECRET_KEY=minio123 | ||
STORE_BUCKET=notea-test | ||
PASSWORD=123 | ||
STORE_END_POINT=http://localhost:9000 | ||
STORE_FORCE_PATH_STYLE=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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Test | ||
on: [push] | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install modules | ||
run: yarn | ||
- name: Run MinIO | ||
run: docker-compose up -d | ||
- name: Run tests | ||
run: yarn 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,26 @@ | ||
import { createServer, IncomingMessage, Server, ServerResponse } from 'http' | ||
import { apiResolver } from 'next/dist/server/api-utils' | ||
import treeHandler from 'pages/api/tree' | ||
import supertest from 'supertest' | ||
|
||
describe('/api/tree', () => { | ||
let server: Server | ||
|
||
beforeEach(async () => { | ||
const requestHandler = ( | ||
request: IncomingMessage, | ||
response: ServerResponse | ||
) => apiResolver(request, response, undefined, treeHandler, {} as any, true) | ||
server = createServer(requestHandler) | ||
}) | ||
|
||
afterEach(() => { | ||
server.close() | ||
}) | ||
|
||
test('create note', async () => { | ||
const result = await supertest(server).get('/api/tree').expect(200) | ||
|
||
expect(result.body).toBeDefined() | ||
}) | ||
}) |
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,20 @@ | ||
require('dotenv').config({ path: '.env.test' }) | ||
|
||
module.exports = { | ||
collectCoverageFrom: ['**/*.{ts}', '!**/*.d.ts', '!**/node_modules/**'], | ||
testPathIgnorePatterns: ['<rootDir>/node_modules/', '<rootDir>/.next/'], | ||
testEnvironment: 'jsdom', | ||
transform: { | ||
/* Use babel-jest to transpile tests with the next/babel preset | ||
https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object */ | ||
'^.+\\.(ts)$': ['babel-jest', { presets: ['next/babel'] }], | ||
}, | ||
transformIgnorePatterns: [ | ||
'/node_modules/', | ||
'^.+\\.module\\.(css|sass|scss)$', | ||
], | ||
moduleNameMapper: { | ||
'pages/(.*)$': '<rootDir>/pages/$1', | ||
'libs/(.*)$': '<rootDir>/libs/$1', | ||
}, | ||
} |
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
Oops, something went wrong.