Skip to content

Commit c466309

Browse files
authored
Merge pull request #29 from EMResearch/naivecoin-js
js sut
2 parents 8071d74 + dfc453f commit c466309

272 files changed

Lines changed: 142431 additions & 12760 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ hs_err_pid*
152152
/jdk_11_gradle/em/external/graphql/patio-api/build
153153

154154

155+
/jdk_8_maven/em/external/rest/restcountries/target/
156+
/jdk_8_maven/em/embedded/rest/restcountries/target/
155157

156158
### JavaScript
157159
/venv/
@@ -172,7 +174,12 @@ hs_err_pid*
172174
/js_npm/rest/disease-sh-api/build/
173175
/js_npm/rest/disease-sh-api/EvoMasterTest.js
174176
/js_npm/rest/disease-sh-api/redis/
175-
177+
/js_npm/rest/nestjs-realworld-example-app/node_modules/
178+
/js_npm/rest/nestjs-realworld-example-app/build/
179+
/js_npm/rest/naivecoin/build/
180+
/js_npm/rest/naivecoin/node_modules/
181+
/js_npm/rest/spaceX/node_modules/
182+
/js_npm/rest/spaceX/build/
176183

177184

178185
#DotNet
@@ -185,3 +192,6 @@ dotnet_3/em/embedded/rest/SampleProjectDriver/logs/
185192
.vs/
186193
*.launchSettings.json
187194
*.sln.DotSettings.user
195+
196+
197+

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ projects, each one with its own license, as clarified in more details beneath.
5858

5959
* SCS (not-known license, artificial string examples coming from different sources)
6060

61+
* SpaceX-API (Apache-2.0 License), from [https://github.com/r-spacex/SpaceX-API](https://github.com/r-spacex/SpaceX-API)
62+
63+
* nestjs-realworld-example-app (ISC), from [https://github.com/lujakob/nestjs-realworld-example-app](https://github.com/lujakob/nestjs-realworld-example-app)
64+
6165
### REST: .Net/C#
6266

6367
* Menu.API (not-known license), from [https://github.com/chayxana/Restaurant-App](https://github.com/chayxana/Restaurant-App)

js_npm/rest/cyclotron/em/app-driver.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const dbHandler = require("./db-handler");
22

3-
43
const http = require("http");
54
const {AddressInfo} = require("net");
65
const mongoose = require('mongoose');
@@ -27,7 +26,7 @@ class AppController extends em.SutController {
2726

2827
getProblemInfo() {
2928
const dto = new em.dto.RestProblemDto();
30-
dto.swaggerJsonUrl = "http://localhost:" + this.port + "/swagger.json";
29+
dto.openApiUrl = "http://localhost:" + this.port + "/swagger.json";
3130

3231
return dto;
3332
}

js_npm/rest/cyclotron/em/driver-Test.js

Lines changed: 0 additions & 26 deletions
This file was deleted.

js_npm/rest/cyclotron/em/sample-Test.js

Lines changed: 0 additions & 110 deletions
This file was deleted.

js_npm/rest/cyclotron/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,15 @@
7171
},
7272
"jest": {
7373
"testEnvironment": "node",
74-
"testRegex": "(em|tests|bbtests)/.*Test\\.(js|jsx|ts|tsx)$",
74+
"testRegex": "em/.*Test\\.(js|jsx|ts|tsx)$",
7575
"collectCoverageFrom": [
7676
"src/**/*.(js|jsx|ts|tsx)"
7777
],
78+
"coverageReporters": [
79+
"json",
80+
"html",
81+
"json-summary"
82+
],
7883
"transformIgnorePatterns": [
7984
"<rootDir>/node_modules/",
8085
"<rootDir>/bbtests/",

js_npm/rest/disease-sh-api/em/app-driver.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {AddressInfo} = require("net");
66
const em = require("evomaster-client-js");
77

88

9-
class AppController extends em.SutController {
9+
class AppController extends em.SutController {
1010

1111

1212
setupForGeneratedTest(){
@@ -27,7 +27,7 @@ class AppController extends em.SutController {
2727

2828
getProblemInfo() {
2929
const dto = new em.dto.RestProblemDto();
30-
dto.swaggerJsonUrl = "http://localhost:" + this.port + "/apidocs/swagger_v3.json";
30+
dto.openApiUrl = "http://localhost:" + this.port + "/apidocs/swagger_v3.json";
3131

3232
return dto;
3333
}
@@ -54,10 +54,11 @@ class AppController extends em.SutController {
5454
}
5555

5656
stopSut() {
57-
return new Promise( (resolve) =>
58-
{
59-
this.server.close( () => resolve());
60-
}
57+
return new Promise( (resolve) => {
58+
this.server.close( () => {
59+
dbHandler.stopDb();
60+
resolve();
61+
});}
6162
);
6263
}
6364

js_npm/rest/disease-sh-api/em/db-handler.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,22 @@ let test_container = null;
77

88
module.exports ={
99
startDb: async () =>{
10-
console.log("start db")
11-
dbPort = process.env.DB_PORT || 50000;
12-
13-
const environment = await new DockerComposeEnvironment(__dirname, "test-redis-db.yml")
14-
.withWaitStrategy("redis_1", Wait.forLogMessage("Ready to accept connections"))
15-
.up();
16-
test_container = await environment.getContainer("redis_1");
17-
exposedDbPort = test_container.getMappedPort(dbPort);
18-
process.env.REDIS_PORT = exposedDbPort;
19-
20-
console.log("connecting redis-server with "+exposedDbPort);
10+
if(process.env.DOCKER_DBC && process.env.DOCKER_DBC === '0'){
11+
console.log("use local redis on port:" + process.env.REDIS_PORT)
12+
}else{
13+
console.log("start docker db")
14+
dbPort = process.env.DB_PORT || 50000;
15+
16+
// solve ioredis connection problem https://github.com/luin/ioredis/issues/763
17+
const environment = await new DockerComposeEnvironment(__dirname, "test-redis-db.yml")
18+
.withWaitStrategy("redis_1", Wait.forLogMessage("Ready to accept connections"))
19+
.up();
20+
test_container = await environment.getContainer("redis_1");
21+
exposedDbPort = test_container.getMappedPort(dbPort);
22+
process.env.REDIS_PORT = exposedDbPort;
23+
24+
console.log("connecting redis-server with " + exposedDbPort+ " " + test_container.getHost());
25+
}
2126
return test_container;
2227
},
2328

js_npm/rest/disease-sh-api/em/sample-Test.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

js_npm/rest/disease-sh-api/em/test-redis-db.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ version: "3.8"
22

33
services:
44
redis:
5-
image: redis:latest
5+
image: redis:6.2.5
6+
command: ["redis-server", "--bind", "redis", "--port", "50000"]
67
ports:
78
- 50000
89
volumes:

0 commit comments

Comments
 (0)