@joystick.js/test-canary 0.0.0-canary.97 → 0.0.0-canary.98

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/test.js CHANGED
@@ -1 +1 @@
1
- import s from"ava";import o from"node-fetch";let a=[];class u{constructor(){this.currentUser=null}async signupUser(e=[]){for(let t=0;t<e?.length;t+=1){const r=e[t],c=await o(`http://localhost:${process.env.PORT}/api/_test/accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(i=>i.json());a.push(c)}}loginUser(e=""){const t=a?.find(r=>r?.emailAddress===e||r?.email_address===e);return this.currentUser=t||null,t}deleteUser(e=""){return o(`http://localhost:${process.env.PORT}/api/_test/accounts`,{method:"DELETE",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})})}before(e=null){return s.serial.before(e)}beforeEach(e=null){return s.beforeEach(e)}after(e=null){return s.after.always(e)}afterEach(e=null){return s.afterEach.always(e)}that(e="",t=null){return s.serial(e,r=>{t(r,this.currentUser)})}}const l=new u;s.serial.after.always(async()=>{for(let n=0;n<a?.length;n+=1){const e=a[n];await l.deleteUser(e?._id||e?.user_id)}});var p=l;export{p as default};
1
+ import s from"ava";import l from"node-fetch";let o=[];class u{constructor(){this.currentUser=null}async signupUser(e=[]){for(let t=0;t<e?.length;t+=1){const r=e[t],a=await l(`http://localhost:${process.env.PORT}/api/_test/accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)}).then(i=>i.json());o.push(a)}}loginUser(e=""){const t=o?.find(r=>r?.emailAddress===e||r?.email_address===e);return this.currentUser=t||null,t}deleteUser(e=""){return l(`http://localhost:${process.env.PORT}/api/_test/accounts`,{method:"DELETE",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify({userId:e})})}before(e=null){return s.serial.before(e)}beforeEach(e=null){return s.beforeEach(e)}after(e=null){return s.after.always(e)}afterEach(e=null){return s.afterEach.always(e)}that(e="",t=null){const r=this.currentUser;return s.serial(e,function(...a){t(...a,r)})}}const c=new u;s.serial.after.always(async()=>{for(let n=0;n<o?.length;n+=1){const e=o[n];await c.deleteUser(e?._id||e?.user_id)}});var p=c;export{p 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.97",
4
+ "version": "0.0.0-canary.98",
5
5
  "description": "Isomorphic testing framework for the Joystick JavaScript framework.",
6
6
  "main": "dist/index.js",
7
7
  "scripts": {
package/src/test.js CHANGED
@@ -66,8 +66,9 @@ class Test {
66
66
  that(description = '', callback = null) {
67
67
  // NOTE: Always run serial so we don't have collisions on component instances
68
68
  // for DOM tests.
69
- return test.serial(description, (assert) => {
70
- callback(assert, this.currentUser);
69
+ const currentUser = this.currentUser;
70
+ return test.serial(description, function (...args) {
71
+ callback(...args, currentUser);
71
72
  });
72
73
  }
73
74
  }