@joystick.js/test-canary 0.0.0-canary.90 → 0.0.0-canary.91

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 t from"ava";import o from"node-fetch";let a=[];t.serial.after.always(async()=>{for(let s=0;s<a?.length;s+=1){const e=a[s];await(void 0).deleteUser(e?._id||e?.user_id)}});class i{constructor(){}async signupUser(e=[]){for(let r=0;r<e?.length;r+=1){const n=e[r],l=await o(`http://localhost:${process.env.PORT}/api/_test/accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(c=>c.json());a.push(l)}}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 t.serial.before(e)}beforeEach(e=null){return t.beforeEach(e)}after(e=null){return t.after.always(e)}afterEach(e=null){return t.afterEach.always(e)}that(e="",r=null){return t.serial(e,r)}}var p=new i;export{p as default};
1
+ import t from"ava";import a from"node-fetch";let n=[];class u{constructor(){}async signupUser(e=[]){for(let r=0;r<e?.length;r+=1){const l=e[r],c=await a(`http://localhost:${process.env.PORT}/api/_test/accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)}).then(i=>i.json());n.push(c)}}deleteUser(e=""){return a(`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 t.serial.before(e)}beforeEach(e=null){return t.beforeEach(e)}after(e=null){return t.after.always(e)}afterEach(e=null){return t.afterEach.always(e)}that(e="",r=null){return t.serial(e,r)}}const o=new u;t.serial.after.always(async()=>{for(let s=0;s<n?.length;s+=1){const e=n[s];await o.deleteUser(e?._id||e?.user_id)}});var f=o;export{f 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.90",
4
+ "version": "0.0.0-canary.91",
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
@@ -3,16 +3,6 @@ import fetch from 'node-fetch';
3
3
 
4
4
  let users = [];
5
5
 
6
- test.serial.after.always(async () => {
7
- // NOTE: Nuke users who were created as part of the test run to avoid
8
- // data collisions in other tests/suites.
9
-
10
- for (let i = 0; i < users?.length; i += 1) {
11
- const user = users[i];
12
- await this.deleteUser(user?._id || user?.user_id);
13
- }
14
- });
15
-
16
6
  class Test {
17
7
  constructor() {
18
8
  }
@@ -73,4 +63,16 @@ class Test {
73
63
  }
74
64
  }
75
65
 
76
- export default new Test();
66
+ const testInstance = new Test();
67
+
68
+ test.serial.after.always(async () => {
69
+ // NOTE: Nuke users who were created as part of the test run to avoid
70
+ // data collisions in other tests/suites.
71
+
72
+ for (let i = 0; i < users?.length; i += 1) {
73
+ const user = users[i];
74
+ await testInstance.deleteUser(user?._id || user?.user_id);
75
+ }
76
+ });
77
+
78
+ export default testInstance;