@joystick.js/test-canary 0.0.0-canary.85 → 0.0.0-canary.87
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 +3 -2
- package/src/test.js +9 -5
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import r from"./test.js";import
|
|
1
|
+
import r from"./test.js";import e from"./helpers/api/index.js";import o from"./helpers/render/index.js";import t 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 p from"./helpers/routes/index.js";import i from"./helpers/uploaders/index.js";import s from"./helpers/websockets/index.js";var k={accounts:{signup:r.signupUser,delete:r.deleteUser},after:r.after,afterEach:r.afterEach,api:e,before:r.before,beforeEach:r.beforeEach,render:o,databases:t,email:m,load:f,queues:a,routes:p,that:r.that,uploaders:i,websockets:s};export{k as default};
|
package/dist/test.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"ava";import a from"node-fetch";let s=[];class c{constructor(){r.serial.after.always(async()=>{for(let e=0;e<s?.length;e+=1){const t=s[e];await this.deleteUser(t?._id||t?.user_id)}})}async signupUser(e=[]){for(let t=0;t<e?.length;t+=1){const o=e[t],n=await a(`http://localhost:${process.env.PORT}/api/_accounts/signup`,{method:"POST",mode:"cors",headers:{"Content-Type":"application/json"},body:JSON.stringify(o)}).then(l=>l.json());s.push(n)}}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 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 p=new c;export{p as default};
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -11,8 +11,9 @@ import websockets from './helpers/websockets/index.js';
|
|
|
11
11
|
|
|
12
12
|
export default {
|
|
13
13
|
accounts: {
|
|
14
|
-
login: test.login,
|
|
15
|
-
signup: test.
|
|
14
|
+
// login: test.login,
|
|
15
|
+
signup: test.signupUser,
|
|
16
|
+
delete: test.deleteUser,
|
|
16
17
|
},
|
|
17
18
|
after: test.after,
|
|
18
19
|
afterEach: test.afterEach,
|
package/src/test.js
CHANGED
|
@@ -5,14 +5,18 @@ let users = [];
|
|
|
5
5
|
|
|
6
6
|
class Test {
|
|
7
7
|
constructor() {
|
|
8
|
-
test.serial.after.always(() => {
|
|
8
|
+
test.serial.after.always(async () => {
|
|
9
9
|
// NOTE: Nuke users who were created as part of the test run to avoid
|
|
10
10
|
// data collisions in other tests/suites.
|
|
11
|
-
|
|
11
|
+
|
|
12
|
+
for (let i = 0; i < users?.length; i += 1) {
|
|
13
|
+
const user = users[i];
|
|
14
|
+
await this.deleteUser(user?._id || user?.user_id);
|
|
15
|
+
}
|
|
12
16
|
});
|
|
13
17
|
}
|
|
14
18
|
|
|
15
|
-
async
|
|
19
|
+
async signupUser(usersToSignup = []) {
|
|
16
20
|
for (let i = 0; i < usersToSignup?.length; i += 1) {
|
|
17
21
|
const userToSignup = usersToSignup[i];
|
|
18
22
|
const user = await fetch(`http://localhost:${process.env.PORT}/api/_accounts/signup`, {
|
|
@@ -28,8 +32,8 @@ class Test {
|
|
|
28
32
|
}
|
|
29
33
|
}
|
|
30
34
|
|
|
31
|
-
|
|
32
|
-
fetch(`http://localhost:${process.env.PORT}/api/_test/accounts`, {
|
|
35
|
+
deleteUser(userId = '') {
|
|
36
|
+
return fetch(`http://localhost:${process.env.PORT}/api/_test/accounts`, {
|
|
33
37
|
method: 'DELETE',
|
|
34
38
|
mode: "cors",
|
|
35
39
|
headers: {
|