generated from Arquisoft/lomap_0
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #104 from Arquisoft/develop
Develop
- Loading branch information
Showing
72 changed files
with
24,015 additions
and
12,133 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
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,10 @@ | ||
NODE_ENV=development | ||
PORT=5000 | ||
|
||
MONGODB_USERNAME=lomap_es2b | ||
MONGODB_PASSWORD=ZPDS0tM0vRoeiSPA | ||
MONGODB_DATABASE_NAME=lomap | ||
MONGODB_TEST_DATABASE_NAME=lm-test | ||
MONGODB_HOST=cluster0.9hp3spq.mongodb.net | ||
|
||
JWT_TOKEN=secret |
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 |
---|---|---|
@@ -1,50 +1,50 @@ | ||
import request, {Response} from 'supertest'; | ||
import express, { Application } from 'express'; | ||
import * as http from 'http'; | ||
import bp from 'body-parser'; | ||
import cors from 'cors'; | ||
import api from '../api'; | ||
|
||
let app:Application; | ||
let server:http.Server; | ||
|
||
beforeAll(async () => { | ||
app = express(); | ||
const port: number = 5000; | ||
const options: cors.CorsOptions = { | ||
origin: ['http://localhost:3000'] | ||
}; | ||
app.use(cors(options)); | ||
app.use(bp.json()); | ||
app.use("/api", api) | ||
|
||
server = app.listen(port, ():void => { | ||
console.log('Restapi server for testing listening on '+ port); | ||
}).on("error",(error:Error)=>{ | ||
console.error('Error occured: ' + error.message); | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
server.close() //close the server | ||
}) | ||
|
||
describe('user ', () => { | ||
/** | ||
* Test that we can list users without any error. | ||
*/ | ||
it('can be listed',async () => { | ||
const response:Response = await request(app).get("/api/users/list"); | ||
expect(response.statusCode).toBe(200); | ||
}); | ||
|
||
/** | ||
* Tests that a user can be created through the productService without throwing any errors. | ||
*/ | ||
it('can be created correctly', async () => { | ||
let username:string = 'Pablo' | ||
let email:string = 'gonzalezgpablo@uniovi.es' | ||
const response:Response = await request(app).post('/api/users/add').send({name: username,email: email}).set('Accept', 'application/json') | ||
expect(response.statusCode).toBe(200); | ||
}); | ||
import request, {Response} from 'supertest'; | ||
import express, { Application } from 'express'; | ||
import * as http from 'http'; | ||
import bp from 'body-parser'; | ||
import cors from 'cors'; | ||
import api from './api'; | ||
|
||
let app:Application; | ||
let server:http.Server; | ||
|
||
beforeAll(async () => { | ||
app = express(); | ||
const port: number = 5000; | ||
const options: cors.CorsOptions = { | ||
origin: ['http://localhost:3000'] | ||
}; | ||
app.use(cors(options)); | ||
app.use(bp.json()); | ||
app.use("/api", api) | ||
|
||
server = app.listen(port, ():void => { | ||
console.log('Restapi server for testing listening on '+ port); | ||
}).on("error",(error:Error)=>{ | ||
console.error('Error occured: ' + error.message); | ||
}); | ||
}); | ||
|
||
afterAll(async () => { | ||
server.close() //close the server | ||
}) | ||
|
||
describe('user ', () => { | ||
/** | ||
* Test that we can list users without any error. | ||
*/ | ||
it('can be listed',async () => { | ||
const response:Response = await request(app).get("/api/users/list"); | ||
expect(response.statusCode).toBe(200); | ||
}); | ||
|
||
/** | ||
* Tests that a user can be created through the productService without throwing any errors. | ||
*/ | ||
it('can be created correctly', async () => { | ||
let username:string = 'Pablo' | ||
let email:string = 'gonzalezgpablo@uniovi.es' | ||
const response:Response = await request(app).post('/api/users/add').send({name: username,email: email}).set('Accept', 'application/json') | ||
expect(response.statusCode).toBe(200); | ||
}); | ||
}); |
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,5 @@ | ||
export default { | ||
transform: { | ||
"^.+\\.tsx?$": "ts-jest" | ||
}, | ||
} |
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,10 @@ | ||
NODE_ENV=development | ||
PORT=5000 | ||
|
||
MONGODB_USERNAME=lomap_test | ||
MONGODB_PASSWORD=UMW9dIUMVryPPBdw | ||
MONGODB_DATABASE_NAME=lm-test | ||
MONGODB_TEST_DATABASE_NAME=lm-test | ||
MONGODB_HOST=cluster0.9hp3spq.mongodb.net | ||
|
||
JWT_TOKEN=secret |
This file was deleted.
Oops, something went wrong.
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.