scs icon indicating copy to clipboard operation
scs copied to clipboard

Session should implement interface to be mockable

Open titouanfreville opened this issue 4 years ago • 2 comments

Hello, To simplify unit testing, it would be nice to implement an interface on the main Session object. Though an interface will mask inner field, implementing an interface and being able to have the Session as interface would greatly simplify clean unit test for code.

titouanfreville avatar Jun 04 '20 20:06 titouanfreville

Hi,

Can you explain/give an example of what you're currently doing and why it is 'unclean'? Is it because you don't want to wrap the handler with LoadAndSave() for the purpose of unit testing that handler alone?

alexedwards avatar Jun 11 '20 08:06 alexedwards

Hy,

It is under unit test where I don't even want to know how the session is used.

Basically, I have a session package with multiple potential implementation, all those implementation needs to be tested from a unit point of vue and simulating the all process of SCS is to heavy under unit testing as it will require to either force memstore object and manipulate http request where I don't want to see them.

I could also wrap the scs package but it's not really nice to do so. ^^

titouanfreville avatar Jun 11 '20 08:06 titouanfreville

I don't want to take this forward at the moment. I'm going to close this issue.

alexedwards avatar Mar 05 '23 09:03 alexedwards