@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 +1 -1
- package/package.json +1 -1
- package/src/test.js +8 -18
package/dist/test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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
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.
|