spitballing about jest mocks
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.26 Replies
crazy train thread
Authentication might be a hurdle.
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
client/game.js
oh i see
doesn't exportUnknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
mmm these files don't actually import or export things...
wtf
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
You could even mock out
update
method if you needed toUnknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
my dist/ directory looks minified
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
test/common/utils/helpers.test.mjs
š
so the common
is a module in module formUnknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
but the actual client files must get like 'concatenated' as the build process or something
I'm looking in
resources/app/
from the foundry installation node versionUnknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
this file tests our helpers, it does not help with testing
aye, i was looking to see how it got the method it was testing, which turns out comes from an actual esmodule
you could check out
test/harness.mjs
if it's there
common
is a module, so we can test it much easier than client codeUnknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
its not the worst idea in the world lol
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
yeah
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
lol
I mean what you have is gonna work fine for simple tests
oh i just read where you figured this is the server code isntead of client code. damn
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View
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
Unknown Userā¢3y ago
Message Not Public
Sign In & Join Server To View