Splitting tests into unit and integration tests
This commit is contained in:
parent
a97fb5df2f
commit
0fe86542a1
9 changed files with 20 additions and 13 deletions
|
|
@ -11,9 +11,11 @@
|
||||||
"preinstall": "export CXX=g++-12",
|
"preinstall": "export CXX=g++-12",
|
||||||
"clean": "rm -r ./dist || true",
|
"clean": "rm -r ./dist || true",
|
||||||
"build": "rollup -c src/server/rollup.config.js",
|
"build": "rollup -c src/server/rollup.config.js",
|
||||||
"test": "jest",
|
"test:unit": "jest tests/unit/*",
|
||||||
|
"test:unit:clean": "npm run test:clear-cache && npm run test:unit",
|
||||||
|
"test:integration": "jest tests/integration/*",
|
||||||
|
"test:integration:clean": "npm run test:clear-cache && npm run test:integration",
|
||||||
"test:clear-cache": "jest --clearCache",
|
"test:clear-cache": "jest --clearCache",
|
||||||
"test:clean": "npm run test:clear-cache && npm run test",
|
|
||||||
"lint": "eslint src/ --ext ts",
|
"lint": "eslint src/ --ext ts",
|
||||||
"prettier": "prettier src tests -w",
|
"prettier": "prettier src tests -w",
|
||||||
"local": "npx ts-node src/local.ts",
|
"local": "npx ts-node src/local.ts",
|
||||||
|
|
|
||||||
5
tests/integration/index.test.ts
Normal file
5
tests/integration/index.test.ts
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
describe('failure', () => {
|
||||||
|
test('should fail', () => {
|
||||||
|
expect(true).toBeFalsy()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import { Logger, LogLevel } from '../../src/common/logger'
|
import { Logger, LogLevel } from '../../../src/common/logger'
|
||||||
|
|
||||||
describe('Logger', () => {
|
describe('Logger', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as password from '../../src/common/password'
|
import * as password from '../../../src/common/password'
|
||||||
|
|
||||||
describe('password', () => {
|
describe('password', () => {
|
||||||
describe('generateSalt', () => {
|
describe('generateSalt', () => {
|
||||||
|
|
@ -3,7 +3,7 @@ import dayjs from 'dayjs'
|
||||||
import {
|
import {
|
||||||
validateJSONRequest,
|
validateJSONRequest,
|
||||||
ValidationError,
|
ValidationError,
|
||||||
} from '../../src/common/request'
|
} from '../../../src/common/request'
|
||||||
|
|
||||||
describe('request', () => {
|
describe('request', () => {
|
||||||
const testDate = dayjs().add(1, 'day')
|
const testDate = dayjs().add(1, 'day')
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import dayjs, { Dayjs } from 'dayjs'
|
import dayjs, { Dayjs } from 'dayjs'
|
||||||
import { DateRange, Reservation } from '../../src/common/reservation'
|
import { DateRange, Reservation } from '../../../src/common/reservation'
|
||||||
|
|
||||||
describe('Reservation', () => {
|
describe('Reservation', () => {
|
||||||
test('will create correct possible dates', () => {
|
test('will create correct possible dates', () => {
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
import { ValidationError, ValidationErrorCode } from '../../src/common/request'
|
import { ValidationError, ValidationErrorCode } from '../../../src/common/request'
|
||||||
import { Reservation } from '../../src/common/reservation'
|
import { Reservation } from '../../../src/common/reservation'
|
||||||
import { work, SchedulerInput } from '../../src/common/scheduler'
|
import { work, SchedulerInput } from '../../../src/common/scheduler'
|
||||||
|
|
||||||
jest.mock('../../src/common/logger')
|
jest.mock('../../../src/common/logger')
|
||||||
jest.useFakeTimers().setSystemTime(new Date('2022-01-01'))
|
jest.useFakeTimers().setSystemTime(new Date('2022-01-01'))
|
||||||
|
|
||||||
describe('scheduler', () => {
|
describe('scheduler', () => {
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
import server from '../../src/server/index'
|
import server from '../../../src/server/index'
|
||||||
import * as scheduler from '../../src/common/scheduler'
|
import * as scheduler from '../../../src/common/scheduler'
|
||||||
import * as utils from '../../src/server/utils'
|
import * as utils from '../../../src/server/utils'
|
||||||
|
|
||||||
const port = Math.round(Math.random() * 50000 + 10000)
|
const port = Math.round(Math.random() * 50000 + 10000)
|
||||||
const baseUrl = `http://localhost:${port}`
|
const baseUrl = `http://localhost:${port}`
|
||||||
Loading…
Add table
Reference in a new issue