@joystick.js/test-canary 0.0.0-canary.63 → 0.0.0-canary.64
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{parseHTML as
|
|
1
|
+
import{parseHTML as m}from"linkedom";import w from"@joystick.js/ui-canary";import d from"node-fetch";import{URL as p,URLSearchParams as u}from"url";import _ from"./event.js";import h from"../load/index.js";const f=()=>{const t=m(`
|
|
2
2
|
<html>
|
|
3
3
|
<head></head>
|
|
4
4
|
<body>
|
|
@@ -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:s,document:e,Element:
|
|
9
|
+
`),{window:s,document:e,Element:r,Event:n,HTMLElement:c}=t;return global.window=s,global.document=e,global.HTMLElement=c,global.Element=r,global.Event=n,global.console={log:console.log,warn:console.warn,error:console.error},t};var E=async(t="",s={})=>{const e=f();window.fetch=d,window.location={origin:`http://localhost:${process.env.PORT}`};const r=new p(`${window?.location?.origin}/api/_test/bootstrap`);r.search=new u({pathToComponent:t});const n=await d(r).then(async o=>o.json());console.log(n),window.joystick={},window.__joystick_data__=n?.data||{},window.__joystick_i18n__=n?.translations||{},window.__joystick_req__={params:{},query:{},context:{user:{}}};const c=await h(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="")=>_(o,l,e)}}};export{E as default};
|
package/package.json
CHANGED
|
@@ -59,10 +59,11 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
59
59
|
// running requests against the app. Maybe have a fixed test user ID (or array of users)
|
|
60
60
|
// like config.test.users = [{ _id: 'abc123', emailAddress: '', password: '' }].
|
|
61
61
|
|
|
62
|
-
console.log(
|
|
63
|
-
|
|
62
|
+
console.log(bootstrap);
|
|
63
|
+
|
|
64
64
|
window.joystick = {};
|
|
65
65
|
window.__joystick_data__ = bootstrap?.data || {};
|
|
66
|
+
window.__joystick_i18n__ = bootstrap?.translations || {};
|
|
66
67
|
window.__joystick_req__ = { params: {}, query: {}, context: { user: {} } };
|
|
67
68
|
|
|
68
69
|
// NOTE: Force default to true as that's the prescribed pattern for
|