forked from b00tc4mp/isdi-bootcamp-202409
-
Notifications
You must be signed in to change notification settings - Fork 0
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
166c6d1
commit d4cc456
Showing
37 changed files
with
331 additions
and
258 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'dotenv/config' | ||
|
||
import * as chai from 'chai' | ||
import chaiAsPromised from 'chai-as-promised'; | ||
|
||
chai.use(chaiAsPromised) | ||
const { expect } = chai | ||
|
||
import db, { User, Post } from 'dat' | ||
import { errors } from "../../com/index.js" | ||
|
||
const { SystemError, NotFoundError, OwnershipError} = errors | ||
|
||
import deletePost from './deletePost.js'; | ||
|
||
//describe es para indicar de que traba la prueba | ||
describe('deletePost', () => { | ||
before (() => db.connect(process.env.MONGO_URL_TEST)) | ||
//antes de cada prueba | ||
beforeEach(() => Promise.all([User.deleteMany(), Post.deleteMany()])) | ||
//la prueba efectiva borrar post | ||
it('succes delete post', () => { | ||
const user = new User({ name: 'Coco Loco', email: '[email protected]', username: 'cocoloco', password: '123123123' }) | ||
const post = new Post({ author: user.id, image: 'https://www.image.com', text: 'hello world' }) | ||
|
||
//guarda el usuario en la base de datos | ||
user.save() | ||
//ahora si guarda me guardas el post | ||
.then(() => post.save()) | ||
// si se gurda el post lo borro | ||
.then(()=> { | ||
deletePost(user.id, post.id) | ||
//si se borra lo buscas | ||
.then(() => Post.findById(post.id)) | ||
//evaluo el post | ||
.then(post => { | ||
expect(post).to.be.null | ||
|
||
} | ||
) | ||
}) | ||
|
||
}) | ||
|
||
|
||
}) | ||
|
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
47 changes: 0 additions & 47 deletions
47
staff/josue-cano/unsocial/app/src/components/functional/AddComment.jsx
This file was deleted.
Oops, something went wrong.
40 changes: 0 additions & 40 deletions
40
staff/josue-cano/unsocial/app/src/components/functional/Comment.jsx
This file was deleted.
Oops, something went wrong.
59 changes: 0 additions & 59 deletions
59
staff/josue-cano/unsocial/app/src/components/functional/Header.jsx
This file was deleted.
Oops, something went wrong.
99 changes: 0 additions & 99 deletions
99
staff/josue-cano/unsocial/app/src/components/functional/Post.jsx
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
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
Oops, something went wrong.