-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-fresh-signup.js
More file actions
63 lines (53 loc) · 1.59 KB
/
Copy pathtest-fresh-signup.js
File metadata and controls
63 lines (53 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Test signup with a fresh email that doesn't exist
const http = require('http');
async function testFreshSignup() {
const testData = JSON.stringify({
"email": `abhay.test.${Date.now()}@gmail.com`,
"password": "Test@1234",
"firstName": "Abhay",
"lastName": "Talreja",
"organizationName": "Axe"
});
const options = {
hostname: 'localhost',
port: 3010,
path: '/api/auth/signup',
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Content-Length': Buffer.byteLength(testData)
}
};
console.log('Testing signup with fresh email...');
console.log('Payload:', JSON.parse(testData));
const req = http.request(options, (res) => {
console.log(`Status Code: ${res.statusCode}`);
let body = '';
res.on('data', (chunk) => {
body += chunk;
});
res.on('end', () => {
console.log('Response Body:', body);
try {
const json = JSON.parse(body);
console.log('Parsed Response:', JSON.stringify(json, null, 2));
if (res.statusCode === 200 && json.success) {
console.log('✅ SUCCESS: Signup completed without email confirmation error!');
if (json.organization) {
console.log('✅ SUCCESS: Organization created successfully!');
}
} else {
console.log('❌ FAILED: Signup failed with error');
}
} catch (e) {
console.log('Failed to parse as JSON');
}
});
});
req.on('error', (error) => {
console.error('Request error:', error);
});
req.write(testData);
req.end();
}
testFreshSignup();