Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Conversation

@Henriquelay
Copy link
Collaborator

@Henriquelay Henriquelay commented Jun 6, 2022

Setups Jest to work properly with Typescript.

TODO: Testing setup using database and endpoints that modify the database

@Henriquelay Henriquelay linked an issue Jun 6, 2022 that may be closed by this pull request
@AtilioA AtilioA changed the title Ceate automated tests Create automated tests Jun 6, 2022
AtilioA
AtilioA previously approved these changes Jun 6, 2022
@AtilioA
Copy link
Owner

AtilioA commented Jun 6, 2022

LGTM for now

@Henriquelay Henriquelay self-assigned this Jun 8, 2022
Copy link
Collaborator Author

@Henriquelay Henriquelay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meu pau fi, difícil pra crl automar teste com DB kkkk o resto tá tudo pronto ja e tô aqui nessa luta

@AtilioA
Copy link
Owner

AtilioA commented Jun 9, 2022

pera vc tava falando daqui
foca em fazer os unitários funcionarem

@Henriquelay
Copy link
Collaborator Author

pera vc tava falando daqui foca em fazer os unitários funcionarem

Os unitários estão bala e exemplos estão já pushados o foda tá sendo testar com DB

// FIXME not actually throwing WTF but when env is actually no set on server it throws. I don't think it have anything to do with asynchronous tests and such, since they are on different threads.
it.skip('fails when `JWT_SECRET` env is not set', () => {
const request = {
// Is there a way to modularize this better? Doesn't feel DRY enough.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

modularize WHAT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The middleware parameters. Request, Reponse and next. I think I did something of the sorts on another project, but I don't have access to the source anymore

import ensureAuthenticated from './ensureAuthenticated';

describe('ensures', () => {
// FIXME not actually throwing WTF but when env is actually no set on server it throws. I don't think it have anything to do with asynchronous tests and such, since they are on different threads.
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it won't throw unless the JWT token is missing. Invalid tokens, etc are caught by our try-catch; only missing tokens throw errors (Error).
Is authConfig.jwt.secret set and loaded correctly? I don't think it is related but as a last resort...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not the JWT token, the JWT_SECRET env

@Henriquelay Henriquelay changed the base branch from master to develop June 15, 2022 01:32
@Henriquelay
Copy link
Collaborator Author

Think it's already enough to start solving for #33 ?

@AtilioA
Copy link
Owner

AtilioA commented Jun 15, 2022

I don't remember where this is standing and I haven't tested it myself, but if it is working for unit tests then I'd say yes

@Henriquelay
Copy link
Collaborator Author

Check status in issue main message. Improvements on DB testing could be made.

@AtilioA
Copy link
Owner

AtilioA commented Jun 15, 2022

Fine by me, we can improve it later

@Henriquelay Henriquelay force-pushed the 27-create-automated-tests branch from 9305d0e to d40663a Compare July 30, 2022 05:24
@AtilioA
Copy link
Owner

AtilioA commented Aug 2, 2022

MIGATIONS 🔥

@AtilioA
Copy link
Owner

AtilioA commented Aug 2, 2022

Make India Great Again

…r favo :plead::plead: não precisa olhar como é feito confia em mim por favor nunca te pedi nada mim der esse dois ponto tô precisando muito obrigado

Signed-off-by: Henriquelay <[email protected]>
@Henriquelay Henriquelay marked this pull request as ready for review August 4, 2022 01:41
@Henriquelay Henriquelay requested a review from AtilioA August 4, 2022 01:41
@Henriquelay Henriquelay merged commit 510a14d into develop Aug 4, 2022
@Henriquelay Henriquelay deleted the 27-create-automated-tests branch August 4, 2022 01:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Create automated tests

3 participants