Skip to content

Commit

Permalink
Merge branch 'backend' into sergio
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiomalv committed Apr 27, 2022
2 parents 465be58 + 80a6bd0 commit f459837
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
24 changes: 12 additions & 12 deletions restapi/tests/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ let server: http.Server;
const admin = {
username: 'admin',
email: '[email protected]',
password: 'Admin1Admin2?',
confirmPassword: 'Admin1Admin2?',
password: process.env.PASS,
confirmPassword: process.env.PASS,
dni: '12345675A',
rol: 1,
status: true
Expand Down Expand Up @@ -64,8 +64,8 @@ describe('user ', () => {
const user = {
username: 'Pablo1',
email: '[email protected]',
password: 'Pabloalonso1?',
confirmPassword: 'Pabloalonso1?',
password: process.env.PASS,
confirmPassword: process.env.PASS,
dni: '12345678A'
}
const response: Response = await request(app).post('/signup').send(user).set('Accept', 'application/json');
Expand All @@ -79,8 +79,8 @@ describe('user ', () => {
const user = {
username: 'Pablo1',
email: '[email protected]',
password: 'Pabloalonso1?',
confirmPassword: 'Pabloalonso1?',
password: process.env.PASS,
confirmPassword: process.env.PASS,
dni: '12345678A'
}
const response: Response = await request(app).post('/signup').send(user).set('Accept', 'application/json');
Expand All @@ -93,7 +93,7 @@ describe('user ', () => {
it('can login correctly', async () => {
const user = {
username: 'Pablo1',
password: 'Pabloalonso1?'
password: process.env.PASS
}
const response: Response = await request(app).post('/login').send(user).set('Accept', 'application/json');

Expand All @@ -109,12 +109,12 @@ describe('user ', () => {
const user = {
username: 'Pablo2',
email: '[email protected]',
password: 'Pabloalonso2?',
confirmPassword: 'Pabloalonso2?',
password: process.env.PASS,
confirmPassword: process.env.PASS,
dni: '12345678B'
}
await request(app).post('/signup').send(user).set('Accept', 'application/json');
const users = await (await (await request(app).get('/user/list').set('Authorization', token).set('Username', admin.username)
const users = await ((await request(app).get('/user/list').set('Authorization', token).set('Username', admin.username)
.set('Accept', 'application/json'))).body.users;

expect(users.length).toBe(3);
Expand Down Expand Up @@ -201,7 +201,7 @@ describe('user ', () => {
pod: 'NOsergiomalv'
}

const response: Response = await (await request(app).post('/user/pod').send(name).set('Authorization', token).set('Accept', 'application/json'));
const response: Response = await request(app).post('/user/pod').send(name).set('Authorization', token).set('Accept', 'application/json');
expect(response.statusCode).toBe(404);
});
});
Expand Down Expand Up @@ -290,4 +290,4 @@ describe('products ', () => {
expect(units.length).toBe(0);
});

});
});
3 changes: 2 additions & 1 deletion restapi/vars.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
process.env.DATABASE_URL = 'mongodb+srv://test:[email protected]/myFirstDatabase?retryWrites=true&w=majority'
process.env.CLOUDINARY_URL = 'cloudinary://634549676984392:ZgCVQWbB3fjb_pNFpeP8A2zzq3o@dede4atest'
process.env.SECRET = 'tokenparatest'
process.env.SECRET = 'tokenparatest'
process.env.PASS = 'Admin1Admin2?'

0 comments on commit f459837

Please sign in to comment.