@joystick.js/test-canary 0.0.0-canary.57 → 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.
@@ -6,4 +6,4 @@ import{parseHTML as s}from"linkedom";import m from"@joystick.js/ui-canary";impor
6
6
  <meta name="csrf" content="joystick_test" />
7
7
  </body>
8
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,{...e,component: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};
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 r from"./test.js";import o from"./helpers/api/index.js";import t from"./helpers/dom/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 x={after:r.after,afterEach:r.afterEach,api:o,before:r.before,beforeEach:r.beforeEach,dom:t,databases:e,email:m,load:a,queues:f,routes:p,that:r.that,uploaders:i,websockets:s};export{x as default};
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@joystick.js/test-canary",
3
3
  "type": "module",
4
- "version": "0.0.0-canary.57",
4
+ "version": "0.0.0-canary.58",
5
5
  "description": "Isomorphic testing framework for the Joystick JavaScript framework.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
@@ -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,8 +64,8 @@ export default async (pathToComponent = '', options = {}) => {
51
64
  component.isTest = true;
52
65
 
53
66
  return {
54
- ...dom,
55
- component,
67
+ dom,
68
+ instance: component,
56
69
  test: {
57
70
  data: async (input = {}) => {
58
71
  return component?.data?.refetch(input);
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 dom from './helpers/dom/index.js';
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
- dom,
18
+ component,
19
19
  databases,
20
20
  email,
21
21
  load,
File without changes
File without changes