@joystick.js/test-canary 0.0.0-canary.56 → 0.0.0-canary.58
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.
- package/dist/helpers/component/index.js +9 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/helpers/{dom → component}/index.js +17 -4
- package/src/index.js +2 -2
- package/dist/helpers/dom/index.js +0 -9
- /package/dist/helpers/{dom → component}/event.js +0 -0
- /package/src/helpers/{dom → component}/event.js +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{parseHTML as s}from"linkedom";import m from"@joystick.js/ui-canary";import d from"node-fetch";import i from"./event.js";import p from"../load/index.js";const u=()=>{const n=s(`
|
|
2
|
+
<html>
|
|
3
|
+
<head></head>
|
|
4
|
+
<body>
|
|
5
|
+
<div id="app"></div>
|
|
6
|
+
<meta name="csrf" content="joystick_test" />
|
|
7
|
+
</body>
|
|
8
|
+
</html>
|
|
9
|
+
`),{window:r,document:e,Element:l,Event:t,HTMLElement:o}=n;return global.window=r,global.document=e,global.HTMLElement=o,global.Element=l,global.Event=t,global.console={log:console.log,warn:console.warn,error:console.error},n};var g=async(n="",r={})=>{const e=u();window.fetch=d,window.location={origin:`http://localhost:${process.env.PORT}`},window.joystick={},window.__joystick_data__={},window.__joystick_req__={params:{},query:{},context:{user:{}}};const l=await p(n,{default:!0}),t=m.mount(l,r?.props||{},e?.document.querySelector("#app"));return t.isTest=!0,{dom:e,instance:t,test:{data:async(o={})=>t?.data?.refetch(o),method:(o="",...a)=>{const c=t?.methods[o];return c?c(...a):null},event:(o="",a="")=>i(o,a,e)}}};export{g as default};
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"./test.js";import r from"./helpers/api/index.js";import t from"./helpers/component/index.js";import e from"./helpers/databases/index.js";import m from"./helpers/email/index.js";import f from"./helpers/queues/index.js";import a from"./helpers/load/index.js";import p from"./helpers/routes/index.js";import i from"./helpers/uploaders/index.js";import s from"./helpers/websockets/index.js";var w={after:o.after,afterEach:o.afterEach,api:r,before:o.before,beforeEach:o.beforeEach,component:t,databases:e,email:m,load:a,queues:f,routes:p,that:o.that,uploaders:i,websockets:s};export{w as default};
|
package/package.json
CHANGED
|
@@ -38,6 +38,19 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
38
38
|
window.location = {
|
|
39
39
|
origin: `http://localhost:${process.env.PORT}`,
|
|
40
40
|
};
|
|
41
|
+
|
|
42
|
+
// TODO: This needs to be more heavily leveraged vis a vis the settings file.
|
|
43
|
+
// Basically, w/o a server we need to be able to pipe in certain data. I *can*
|
|
44
|
+
// technically fetch data internally here and set it (may need some internal
|
|
45
|
+
// endpoints like /api/_test/blah to do it so we can grab translations, etc).
|
|
46
|
+
//
|
|
47
|
+
// One thing we can do with something like test.route() is to auto-map the stuff
|
|
48
|
+
// that's on the window over to the return value from that function. So, we get back
|
|
49
|
+
// something like { html: '', req: {}, data: {}, user: {} }, etc. We want to account
|
|
50
|
+
// for things like having a test user in the config, too, so we're legitimately
|
|
51
|
+
// running requests against the app. Maybe have a fixed test user ID (or array of users)
|
|
52
|
+
// like config.test.users = [{ _id: 'abc123', emailAddress: '', password: '' }].
|
|
53
|
+
|
|
41
54
|
window.joystick = {};
|
|
42
55
|
window.__joystick_data__ = {};
|
|
43
56
|
window.__joystick_req__ = { params: {}, query: {}, context: { user: {} } };
|
|
@@ -51,11 +64,11 @@ export default async (pathToComponent = '', options = {}) => {
|
|
|
51
64
|
component.isTest = true;
|
|
52
65
|
|
|
53
66
|
return {
|
|
54
|
-
|
|
55
|
-
component,
|
|
67
|
+
dom,
|
|
68
|
+
instance: component,
|
|
56
69
|
test: {
|
|
57
|
-
data: async () => {
|
|
58
|
-
return component?.data?.refetch();
|
|
70
|
+
data: async (input = {}) => {
|
|
71
|
+
return component?.data?.refetch(input);
|
|
59
72
|
},
|
|
60
73
|
method: (methodName = '', ...methodArgs) => {
|
|
61
74
|
const methodToCall = component?.methods[methodName];
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import test from './test.js';
|
|
2
2
|
import api from './helpers/api/index.js';
|
|
3
|
-
import
|
|
3
|
+
import component from './helpers/component/index.js';
|
|
4
4
|
import databases from './helpers/databases/index.js';
|
|
5
5
|
import email from './helpers/email/index.js';
|
|
6
6
|
import queues from './helpers/queues/index.js';
|
|
@@ -15,7 +15,7 @@ export default {
|
|
|
15
15
|
api,
|
|
16
16
|
before: test.before,
|
|
17
17
|
beforeEach: test.beforeEach,
|
|
18
|
-
|
|
18
|
+
component,
|
|
19
19
|
databases,
|
|
20
20
|
email,
|
|
21
21
|
load,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{parseHTML as s}from"linkedom";import m from"@joystick.js/ui-canary";import d from"node-fetch";import i from"./event.js";import p from"../load/index.js";const u=()=>{const n=s(`
|
|
2
|
-
<html>
|
|
3
|
-
<head></head>
|
|
4
|
-
<body>
|
|
5
|
-
<div id="app"></div>
|
|
6
|
-
<meta name="csrf" content="joystick_test" />
|
|
7
|
-
</body>
|
|
8
|
-
</html>
|
|
9
|
-
`),{window:r,document:t,Element:l,Event:o,HTMLElement:e}=n;return global.window=r,global.document=t,global.HTMLElement=e,global.Element=l,global.Event=o,global.console={log:console.log,warn:console.warn,error:console.error},n};var g=async(n="",r={})=>{const t=u();window.fetch=d,window.location={origin:`http://localhost:${process.env.PORT}`},window.joystick={},window.__joystick_data__={},window.__joystick_req__={params:{},query:{},context:{user:{}}};const l=await p(n,{default:!0}),o=m.mount(l,r?.props||{},t?.document.querySelector("#app"));return o.isTest=!0,{...t,component:o,test:{data:async()=>o?.data?.refetch(),method:(e="",...a)=>{const c=o?.methods[e];return c?c(...a):null},event:(e="",a="")=>i(e,a,t)}}};export{g as default};
|
|
File without changes
|
|
File without changes
|