@joystick.js/test-canary 0.0.0-canary.77 → 0.0.0-canary.79
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/index.js +1 -1
- package/dist/test.js +1 -1
- package/package.json +1 -1
- package/src/index.js +4 -0
- package/src/test.js +18 -4
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./test.js";import o from"./helpers/api/index.js";import
|
|
1
|
+
import r from"./test.js";import o from"./helpers/api/index.js";import t from"./helpers/render/index.js";import e from"./helpers/databases/index.js";import m from"./helpers/email/index.js";import a from"./helpers/queues/index.js";import f from"./helpers/load/index.js";import i from"./helpers/routes/index.js";import p from"./helpers/uploaders/index.js";import s from"./helpers/websockets/index.js";var q={accounts:{login:r.login,signup:r.signup},after:r.after,afterEach:r.afterEach,api:o,before:r.before,beforeEach:r.beforeEach,render:t,databases:e,email:m,load:f,queues:a,routes:i,that:r.that,uploaders:p,websockets:s};export{q as default};
|
package/dist/test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
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};
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -10,6 +10,10 @@ import uploaders from './helpers/uploaders/index.js';
|
|
|
10
10
|
import websockets from './helpers/websockets/index.js';
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
|
+
accounts: {
|
|
14
|
+
login: test.login,
|
|
15
|
+
signup: test.signup,
|
|
16
|
+
},
|
|
13
17
|
after: test.after,
|
|
14
18
|
afterEach: test.afterEach,
|
|
15
19
|
api,
|
package/src/test.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import test from 'ava';
|
|
2
|
+
import { URL } from "url";
|
|
3
|
+
import fetch from 'node-fetch';
|
|
2
4
|
|
|
3
5
|
let users = [];
|
|
4
6
|
|
|
5
|
-
// NOTE: Internal cleaup to avoid confusing tests.
|
|
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.
|
|
7
10
|
console.log('CLEANUP USERS', users);
|
|
8
11
|
});
|
|
9
12
|
|
|
@@ -12,9 +15,20 @@ class Test {
|
|
|
12
15
|
|
|
13
16
|
}
|
|
14
17
|
|
|
15
|
-
signup(usersToSignup = []) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
async signup(usersToSignup = []) {
|
|
19
|
+
for (let i = 0; i < usersToSignup?.length; i += 1) {
|
|
20
|
+
const userToSignup = usersToSignup[i];
|
|
21
|
+
const user = await fetch(`http://localhost:${process.env.PORT}/api/_accounts/signup`, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
mode: "cors",
|
|
24
|
+
headers: {
|
|
25
|
+
"Content-Type": "application/json",
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify(userToSignup)
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
users.push(user);
|
|
31
|
+
}
|
|
18
32
|
}
|
|
19
33
|
|
|
20
34
|
login(user = {}) {
|