@joystick.js/test-canary 0.0.0-canary.79 → 0.0.0-canary.80

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"url";import a from"node-fetch";let o=[];t.serial.after.always(()=>{console.log("CLEANUP USERS",o)});class l{constructor(){}async signup(e=[]){for(let r=0;r<e?.length;r+=1){const s=e[r],n=await a(`http://localhost:${process.env.PORT}/api/_accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});o.push(n)}}login(e={}){}accounts(){return{signup:this.signup,login:this.login}}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 h=new l;export{h as default};
1
+ import r from"ava";import o from"node-fetch";class n{constructor(){this.users=[],r.serial.after.always(()=>{console.log("CLEANUP USERS",this.users)})}async signup(e=[]){for(let t=0;t<e?.length;t+=1){const s=e[t],a=await o(`http://localhost:${process.env.PORT}/api/_accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});this.users.push(a)}}login(e={}){}before(e=null){return r.serial.before(e)}beforeEach(e=null){return r.beforeEach(e)}after(e=null){return r.after.always(e)}afterEach(e=null){return r.afterEach.always(e)}that(e="",t=null){return r.serial(e,t)}}var i=new n;export{i 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.79",
4
+ "version": "0.0.0-canary.80",
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
@@ -1,18 +1,15 @@
1
1
  import test from 'ava';
2
- import { URL } from "url";
3
2
  import fetch from 'node-fetch';
4
3
 
5
- let users = [];
6
-
7
- test.serial.after.always(() => {
8
- // NOTE: Nuke users who were created as part of the test run to avoid
9
- // data collisions in other tests/suites.
10
- console.log('CLEANUP USERS', users);
11
- });
12
-
13
4
  class Test {
14
5
  constructor() {
15
-
6
+ this.users = [];
7
+
8
+ test.serial.after.always(() => {
9
+ // NOTE: Nuke users who were created as part of the test run to avoid
10
+ // data collisions in other tests/suites.
11
+ console.log('CLEANUP USERS', this.users);
12
+ });
16
13
  }
17
14
 
18
15
  async signup(usersToSignup = []) {
@@ -27,7 +24,7 @@ class Test {
27
24
  body: JSON.stringify(userToSignup)
28
25
  });
29
26
 
30
- users.push(user);
27
+ this.users.push(user);
31
28
  }
32
29
  }
33
30
 
@@ -39,13 +36,6 @@ class Test {
39
36
  // test.
40
37
  }
41
38
 
42
- accounts() {
43
- return {
44
- signup: this.signup,
45
- login: this.login,
46
- };
47
- }
48
-
49
39
  before(callback = null) {
50
40
  // NOTE: Prefer serial before to async to align better with
51
41
  // expectations and avoid confusion.