@joystick.js/test-canary 0.0.0-canary.97 → 0.0.0-canary.99
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 +1 -1
- package/package.json +1 -1
- package/src/test.js +3 -7
package/dist/test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"ava";import
|
|
1
|
+
import s from"ava";import a from"node-fetch";let o=[];class u{constructor(){}async signupUser(e=[]){for(let t=0;t<e?.length;t+=1){const n=e[t],c=await a(`http://localhost:${process.env.PORT}/api/_test/accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}).then(i=>i.json());o.push(c)}}loginUser(e=""){const t=o?.find(n=>n?.emailAddress===e||n?.email_address===e);return window.__joystick_test_user__=t,t}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 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,t)}}const l=new u;s.serial.after.always(async()=>{for(let r=0;r<o?.length;r+=1){const e=o[r];await l.deleteUser(e?._id||e?.user_id)}});var p=l;export{p as default};
|
package/package.json
CHANGED
package/src/test.js
CHANGED
|
@@ -4,9 +4,7 @@ import fetch from 'node-fetch';
|
|
|
4
4
|
let users = [];
|
|
5
5
|
|
|
6
6
|
class Test {
|
|
7
|
-
constructor() {
|
|
8
|
-
this.currentUser = null;
|
|
9
|
-
}
|
|
7
|
+
constructor() {}
|
|
10
8
|
|
|
11
9
|
async signupUser(usersToSignup = []) {
|
|
12
10
|
for (let i = 0; i < usersToSignup?.length; i += 1) {
|
|
@@ -26,7 +24,7 @@ class Test {
|
|
|
26
24
|
|
|
27
25
|
loginUser(emailAddress = '') {
|
|
28
26
|
const user = users?.find((user) => user?.emailAddress === emailAddress || user?.email_address === emailAddress);
|
|
29
|
-
|
|
27
|
+
window.__joystick_test_user__ = user;
|
|
30
28
|
return user;
|
|
31
29
|
}
|
|
32
30
|
|
|
@@ -66,9 +64,7 @@ class Test {
|
|
|
66
64
|
that(description = '', callback = null) {
|
|
67
65
|
// NOTE: Always run serial so we don't have collisions on component instances
|
|
68
66
|
// for DOM tests.
|
|
69
|
-
return test.serial(description,
|
|
70
|
-
callback(assert, this.currentUser);
|
|
71
|
-
});
|
|
67
|
+
return test.serial(description, callback);
|
|
72
68
|
}
|
|
73
69
|
}
|
|
74
70
|
|