Coder Social home page Coder Social logo

Functionnal testing with auth about core HOT 7 CLOSED

Moumouuu avatar Moumouuu commented on May 20, 2024
Functionnal testing with auth

from core.

Comments (7)

RomainLanz avatar RomainLanz commented on May 20, 2024

Hey @Moumouuu! 👋🏻

Have you added the authApiClient plugin to Japa and activated the memory driver for the session store when testing as per our documentation?

Also, you must use the Session module when using the Session Guard

from core.

Moumouuu avatar Moumouuu commented on May 20, 2024

Thank you for the quick response!

Could you please clarify what you meant by 'added the authApiClient plugin to Japa and activated the memory driver for the session store'?

As shown in my screenshot, I included the authApiClient in the plugins section of bootstrap.ts, and in .env.test, I configured 'SESSION_DRIVER=memory'. Additionally, I'm utilizing Session and Session Guard.

I'm really following the documentation closely..

from core.

quentinhaenn avatar quentinhaenn commented on May 20, 2024

unfortunately i'm facing the exact same issue, following the doc guidelines for auth testing but cannot resolve it with ease. I already verified that before each test the SESSION_DRIVER is set to memory using env.get("SESSION_DRIVER"), added authApiClient in test/bootstrap.ts file as a plugin, and using the loginAs func to provide a authenticated session. But, as far as I understand, the client used in my test has type ApiClient, not authApiClient, might this be the cause of the TypeError thrown ?

from core.

RomainLanz avatar RomainLanz commented on May 20, 2024

It seems that your reproduction is not updated. Could you please push your latest version @Moumouuu?

Could you also try to change the loading order of the Japa plugins and put the authApiClient plugin at the end.

from core.

Moumouuu avatar Moumouuu commented on May 20, 2024

I pushed my modifications and also added authApiClient at the end, but no changes occurred.

On this branch : https://github.com/Avocado-Community/api.avocadogrowth/tree/11-dev-logout

from core.

thetutlage avatar thetutlage commented on May 20, 2024

You are also missing the sessionApiClient. I highly recommend reading the docs carefully, since all this is covered in docs very clearly.

from core.

quentinhaenn avatar quentinhaenn commented on May 20, 2024

Thanks for the answer !

I highly recommend reading the docs carefully, since all this is covered in docs very clearly.

Since the two of us followed very carefully the docs, but did not found the right command or plugin to use, I may recommend to detail the two cases in the doc, separating specs required for auth testing with session and those for auth testing without session, it was very unclear for us that the authApiClient did not handle that itslef.

Anyway, I think a complete minimum working example would greatly enhance the documentation for these particular cases.

Thanks again !

from core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.