@joystick.js/test-canary 0.0.0-canary.90 → 0.0.0-canary.92
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 +14 -11
package/dist/test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import t from"ava";import
|
|
1
|
+
import t from"ava";import n from"node-fetch";let o=[];class u{constructor(){}async signupUser(e=[]){for(let s=0;s<e?.length;s+=1){const l=e[s],c=await n(`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());o.push(c)}}deleteUser(e=""){return n(`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="",s=null){return t.serial(e,s)}}const a=new u;t.serial.after.always(async()=>{for(let r=0;r<o?.length;r+=1){const e=o[r];console.log(e),await a.deleteUser(e?._id||e?.user_id)}});var f=a;export{f as default};
|
package/package.json
CHANGED
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,17 @@ class Test {
|
|
|
73
63
|
}
|
|
74
64
|
}
|
|
75
65
|
|
|
76
|
-
|
|
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
|
+
console.log(user);
|
|
75
|
+
await testInstance.deleteUser(user?._id || user?.user_id);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export default testInstance;
|