@joystick.js/test-canary 0.0.0-canary.61 → 0.0.0-canary.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,4 +6,4 @@ import{parseHTML as d}from"linkedom";import w from"@joystick.js/ui-canary";impor
6
6
  <meta name="csrf" content="joystick_test" />
7
7
  </body>
8
8
  </html>
9
- `),{window:a,document:e,Element:n,Event:s,HTMLElement:c}=t;return global.window=a,global.document=e,global.HTMLElement=c,global.Element=n,global.Event=s,global.console={log:console.log,warn:console.warn,error:console.error},t};var k=async(t="",a={})=>{const e=y();window.fetch=m,window.location={origin:`http://localhost:${process.env.PORT}`};const n=new p(`${window?.location?.origin}/api/_test/bootstrap`);n.search=new u({pathToComponent:t});const s=await m(n).then(async o=>o.json());console.log({bootstrap:s}),window.joystick={},window.__joystick_data__={},window.__joystick_req__={params:{},query:{},context:{user:{}}};const c=await f(t,{default:!0}),r=w.mount(c,a?.props||{},e?.document.querySelector("#app"));return r.isTest=!0,{dom:e,instance:r,test:{data:async(o={})=>r?.data?.refetch(o),method:(o="",...l)=>{const i=r?.methods[o];return i?i(...l):null},event:(o="",l="")=>h(o,l,e)}}};export{k as default};
9
+ `),{window:s,document:e,Element:n,Event:r,HTMLElement:c}=t;return global.window=s,global.document=e,global.HTMLElement=c,global.Element=n,global.Event=r,global.console={log:console.log,warn:console.warn,error:console.error},t};var k=async(t="",s={})=>{const e=y();window.fetch=m,window.location={origin:`http://localhost:${process.env.PORT}`};const n=new p(`${window?.location?.origin}/api/_test/bootstrap`);n.search=new u({pathToComponent:t});const r=await m(n).then(async o=>o.json());console.log({bootstrap:r}),window.joystick={},window.__joystick_data__=r?.data||{},window.__joystick_req__={params:{},query:{},context:{user:{}}};const c=await f(t,{default:!0}),a=w.mount(c,s?.props||{},e?.document.querySelector("#app"));return a.isTest=!0,{dom:e,instance:a,test:{data:async(o={})=>a?.data?.refetch(o),method:(o="",...l)=>{const i=a?.methods[o];return i?i(...l):null},event:(o="",l="")=>h(o,l,e)}}};export{k as default};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/test-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.61",
4
+ "version": "0.0.0-canary.63",
5
5
  "description": "Isomorphic testing framework for the Joystick JavaScript framework.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
@@ -47,8 +47,6 @@ export default async (pathToComponent = '', options = {}) => {
47
47
 
48
48
  const bootstrap = await fetch(url).then(async (response) => response.json());
49
49
 
50
- console.log({ bootstrap });
51
-
52
50
  // TODO: This needs to be more heavily leveraged vis a vis the settings file.
53
51
  // Basically, w/o a server we need to be able to pipe in certain data. I *can*
54
52
  // technically fetch data internally here and set it (may need some internal
@@ -61,8 +59,10 @@ export default async (pathToComponent = '', options = {}) => {
61
59
  // running requests against the app. Maybe have a fixed test user ID (or array of users)
62
60
  // like config.test.users = [{ _id: 'abc123', emailAddress: '', password: '' }].
63
61
 
62
+ console.log({ bootstrap });
63
+
64
64
  window.joystick = {};
65
- window.__joystick_data__ = {};
65
+ window.__joystick_data__ = bootstrap?.data || {};
66
66
  window.__joystick_req__ = { params: {}, query: {}, context: { user: {} } };
67
67
 
68
68
  // NOTE: Force default to true as that's the prescribed pattern for