@joystick.js/test-canary 0.0.0-canary.95 → 0.0.0-canary.96
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/package.json +1 -1
- package/src/test.js +20 -1
- package/dist/test.js +0 -1
package/package.json
CHANGED
package/src/test.js
CHANGED
|
@@ -5,6 +5,7 @@ let users = [];
|
|
|
5
5
|
|
|
6
6
|
class Test {
|
|
7
7
|
constructor() {
|
|
8
|
+
this.currentUser = null;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
async signupUser(usersToSignup = []) {
|
|
@@ -23,6 +24,22 @@ class Test {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
27
|
+
loginUser(emailAddress = '') {
|
|
28
|
+
for (let i = 0; i < usersToSignup?.length; i += 1) {
|
|
29
|
+
const userToSignup = usersToSignup[i];
|
|
30
|
+
const user = await fetch(`http://localhost:${process.env.PORT}/api/_test/accounts/signup`, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
mode: "cors",
|
|
33
|
+
headers: {
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(userToSignup)
|
|
37
|
+
}).then((response) => response.json());
|
|
38
|
+
|
|
39
|
+
users.push(user);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
26
43
|
deleteUser(userId = '') {
|
|
27
44
|
return fetch(`http://localhost:${process.env.PORT}/api/_test/accounts`, {
|
|
28
45
|
method: 'DELETE',
|
|
@@ -59,7 +76,9 @@ class Test {
|
|
|
59
76
|
that(description = '', callback = null) {
|
|
60
77
|
// NOTE: Always run serial so we don't have collisions on component instances
|
|
61
78
|
// for DOM tests.
|
|
62
|
-
return test.serial(description,
|
|
79
|
+
return test.serial(description, (assert) => {
|
|
80
|
+
callback(assert, this.currentUser);
|
|
81
|
+
});
|
|
63
82
|
}
|
|
64
83
|
}
|
|
65
84
|
|
package/dist/test.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
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};
|