Skip to content

Commit

Permalink
Add client-testing-modules
Browse files Browse the repository at this point in the history
Ref: #7
  • Loading branch information
projkov committed Sep 6, 2024
1 parent 87f0cca commit 27a8a5b
Show file tree
Hide file tree
Showing 31 changed files with 59 additions and 54 deletions.
11 changes: 11 additions & 0 deletions packages/client-testing-modules/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "@beda.software/client-testing-modules",
"version": "0.0.1",
"description": "",
"main": "dist/index.js",
"scripts": {
"prepare": "tsc"
},
"author": "",
"license": "ISC"
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { RequestModule } from './modules/requests/request.module';
import { SessionModule } from './modules/sessions/session.module';
import { TestRunModule } from './modules/test_runs/testRun.module';
import { RequestModule } from './requests/request.module';
import { SessionModule } from './sessions/session.module';
import { TestRunModule } from './test_runs/testRun.module';
import { ConfigModule } from '@nestjs/config';
import { ProxyAppModule } from './modules/proxyapp/proxyapp.module';
import { ProxyAppModule } from './proxyapp/proxyapp.module';

@Module({
imports: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { parseSearchRequest } from '@medplum/core';
import { Request, Response } from 'express';
import { CreateRequestDto } from 'src/modules/requests/request.dto';
import { Session } from 'src/modules/sessions/session.entity';
import { getFHIRAction } from '@beda.software/client-testing-helpers';
import { CreateRequestDto } from './requests/request.dto';
import { Session } from './sessions/session.entity';

export function createRequestObject(
id: string,
Expand Down
6 changes: 6 additions & 0 deletions packages/client-testing-modules/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { AppModule } from './app.module';
import { Request } from './requests/request.entity';
import { Session } from './sessions/session.entity';
import { TestRun } from './test_runs/testRun.entity';

export { AppModule, Request, Session, TestRun };
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { All, Controller, Param, Req, Res } from '@nestjs/common';
import { ApiTags, ApiOperation, ApiParam } from '@nestjs/swagger';
import { createRequestObject } from 'src/utils/data';
import { captureResponseBody } from '@beda.software/client-testing-proxy-helpers';
import { RequestService } from '../requests/request.service';
import { SessionService } from '../sessions/session.service';
import { Request, Response } from 'express';
import { createRequestObject } from '../data';

@ApiTags('app')
@Controller('app')
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { Request as RequestType, Response } from 'express';
import { Session } from '../sessions/session.entity';
import { jsonbType } from 'src/utils/types';
import { jsonbType } from '../types';

export class CreateRequestDto {
@ApiProperty({ description: 'Session associated with the request' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Response, Request as RequestType } from 'express';
import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, ManyToOne } from 'typeorm';
import { Session } from '../sessions/session.entity';
import { jsonbType } from 'src/utils/types';
import { jsonbType } from '../types';

@Entity()
export class Request {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { InitiateTestRunDto } from './testRun.dto';
import { Response } from 'express';
import { runCLI } from '@jest/core';
import { TestRunService } from './testRun.service';
import { SessionService } from '../sessions/session.service';
import { TestRun } from './testRun.entity';
import { SessionService } from '../sessions/session.service';

const testOptions = {
globalSetup: './src/utils/setup/jest.setup.ts',
Expand All @@ -23,7 +23,7 @@ export class TestRunController {
constructor(
private readonly testRunService: TestRunService,
private readonly sessionService: SessionService,
) { }
) {}

@Post()
@ApiOperation({ summary: 'Create a new test session' })
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { json } from 'node:stream/consumers';
import { jsonbType } from 'src/utils/types';
import { Session } from '../sessions/session.entity';
import { jsonbType } from '../types';

export class CreateTestRunDto {
@ApiProperty({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';
import { Session } from '../sessions/session.entity';
import { jsonbType } from 'src/utils/types';
import { jsonbType } from '../types';
import { Column, CreateDateColumn, Entity, ManyToOne, PrimaryGeneratedColumn } from 'typeorm';

@Entity()
export class TestRun {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions packages/client-testing-modules/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"removeComments": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"target": "ES2021",
"sourceMap": true,
"outDir": "./dist",
"baseUrl": "./",
"incremental": true,
"skipLibCheck": true,
"strictNullChecks": false,
"noImplicitAny": false,
"strictBindCallApply": false,
"forceConsistentCasingInFileNames": false,
"noFallthroughCasesInSwitch": false,
"noEmit": false
}
}
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import 'reflect-metadata';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { initialValidateResource } from '@beda.software/fhir-validator';
import { AppModule } from '@beda.software/client-testing-modules';

async function bootstrap() {
const app = await NestFactory.create(AppModule, { cors: true });
Expand Down
2 changes: 1 addition & 1 deletion src/suites/1.0.0-ballot/Patient/patients.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
getRequestsWithUnavailableComboSearchParams,
getRequestsWithUnavailableSearchParams,
} from '../../../utils/clientTestingHelpers';
import { Request } from '../../../modules/requests/request.entity';
import { Request } from '../../../../packages/client-testing-modules/src/requests/request.entity';
import { isResourceValid } from '@beda.software/fhir-validator';

// function patientRequestsOnlyAvailableInteractionsExists(requests: Request[]): boolean {
Expand Down
6 changes: 2 additions & 4 deletions src/utils/clientTestingHelpers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import { DataSource } from 'typeorm';
import { Request } from '../modules/requests/request.entity';
import { Session } from '../modules/sessions/session.entity';
import { TestRun } from '../modules/test_runs/testRun.entity';
import { Request, Session, TestRun } from '@beda.software/client-testing-modules';
import {
getRequestsWithUnavailableComboSearchParams,
getRequestsWithUnavailableSearchParams,
} from './clientTestingHelpers';
import { v4 as uuidv4 } from 'uuid';
import { createRequestObject } from './data';
import { createRequestObject } from '../../packages/client-testing-modules/src/data';

const TestDataSource = new DataSource({
type: 'postgres',
Expand Down
2 changes: 1 addition & 1 deletion src/utils/clientTestingHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Request } from 'src/modules/requests/request.entity';
import { Request } from 'packages/client-testing-modules/src/requests/request.entity';
import { Repository } from 'typeorm';

/**
Expand Down
4 changes: 1 addition & 3 deletions src/utils/setup/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Session, Request, TestRun } from '@beda.software/client-testing-modules';
import { DataSource } from 'typeorm';
import { Request } from '../../modules/requests/request.entity';
import { Session } from '../../modules/sessions/session.entity';
import { TestRun } from '../../modules/test_runs/testRun.entity';

const TestDataSource = new DataSource({
type: 'postgres',
Expand Down
21 changes: 0 additions & 21 deletions test/app.e2e-spec.ts

This file was deleted.

9 changes: 0 additions & 9 deletions test/jest-e2e.json

This file was deleted.

0 comments on commit 27a8a5b

Please sign in to comment.