-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d8cc7ec
commit 3c4ec92
Showing
3 changed files
with
50 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
const router = require('express').Router(); | ||
|
||
// router.delete('/:estateId', isAuth, isAdmin, deleteEstate); | ||
// const { isAuth, isAdmin } = require('../middleware'); | ||
const { isAuth, isAdmin } = require('../middleware'); | ||
const { editEstate, deleteEstate } = require('../controllers'); | ||
|
||
router.put('/:estateId', editEstate); | ||
|
||
router.delete('/:estateId', isAuth, isAdmin, deleteEstate); | ||
router.delete('/:estateId', deleteEstate); | ||
module.exports = router; |
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 |
---|---|---|
|
@@ -181,6 +181,7 @@ describe('Delete Specific Estate By Using Id', () => { | |
}); | ||
}); | ||
}); | ||
|
||
describe('test signup endpoint with all cases ', () => { | ||
test('test sign up endpoint when success', async () => { | ||
const res = await supertest(app) | ||
|
@@ -250,3 +251,49 @@ describe('test signup endpoint with all cases ', () => { | |
}); | ||
}); | ||
}); | ||
|
||
describe('test Edit Agent data /users/:iduser ', () => { | ||
test('test 200', async () => { | ||
const res = await supertest(app) | ||
.put('/api/v1/users/1') | ||
.send({ | ||
username: 'test', | ||
email: '[email protected]', | ||
phone: '059985555555', | ||
}) | ||
.expect(200) | ||
.expect('Content-Type', /json/); | ||
return expect(res.body).toEqual({ | ||
message: 'Agent\'s data updated successfully', | ||
}); | ||
}); | ||
|
||
test('test 400', async () => { | ||
const res = await supertest(app) | ||
.put('/api/v1/users/1') | ||
.send({ | ||
username: 'test', | ||
email: '[email protected]', | ||
phone: '0599', | ||
}) | ||
.expect(400) | ||
.expect('Content-Type', /json/); | ||
return expect(res.body).toEqual({ | ||
message: '"phone" length must be at least 9 characters long', | ||
}); | ||
}); | ||
test('test 404', async () => { | ||
const res = await supertest(app) | ||
.put('/api/v1/users/400') | ||
.send({ | ||
username: 'test', | ||
email: '[email protected]', | ||
phone: '059915587555', | ||
}) | ||
.expect(404) | ||
.expect('Content-Type', /json/); | ||
return expect(res.body).toEqual({ | ||
message: 'There\'s no Agent, put correct id', | ||
}); | ||
}); | ||
}); |