spitballing about jest mocks

CCalego5/8/2022
ok. ok. ok. pure spitballing theory here.

All the client side source exists in esmodule form (hopefully importing from eachother?)

So then it stands to reason that a jest instance could instanciate an actual Game instance as though it were actually an active game session. With something that mocks out a browser standing in for all the browser APIs, "All you'd need to mock" would be the socket connection server calls.
CCalego5/8/2022
crazy train thread
CCalego5/8/2022
Authentication might be a hurdle.
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
client/game.js
CCalego5/8/2022
oh i see
CCalego5/8/2022
doesn't export
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
mmm these files don't actually import or export things...
CCalego5/8/2022
wtf
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
You could even mock out update method if you needed to
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
my dist/ directory looks minified
UUUnknown User5/8/2022
3 Messages Not Public
Sign In & Join Server To View
CCalego5/8/2022
test/common/utils/helpers.test.mjs
CCalego5/8/2022
👀
CCalego5/8/2022
so the common is a module in module form
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
but the actual client files must get like 'concatenated' as the build process or something
CCalego5/8/2022
I'm looking in resources/app/ from the foundry installation node version
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
Ccswendrowski5/8/2022
this file tests our helpers, it does not help with testing
CCalego5/8/2022
aye, i was looking to see how it got the method it was testing, which turns out comes from an actual esmodule
Ccswendrowski5/8/2022
you could check out test/harness.mjs if it's there
Ccswendrowski5/8/2022
common is a module, so we can test it much easier than client code
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
its not the worst idea in the world lol
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
yeah
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
lol
CCalego5/8/2022
I mean what you have is gonna work fine for simple tests
CCalego5/8/2022
oh i just read where you figured this is the server code isntead of client code. damn
UUUnknown User5/8/2022
Message Not Public
Sign In & Join Server To View
CCalego5/8/2022
https://jestjs.io/docs/es6-class-mocks

This is what I was hoping was possible, but isn't with the client files not exporting things
UUUnknown User5/8/2022
8 Messages Not Public
Sign In & Join Server To View