add searching, total unread message, create user
This commit is contained in:
44
test-search.js
Normal file
44
test-search.js
Normal file
@@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Quick test script for JMAP search endpoint
|
||||
* Run with: node test-search.js
|
||||
*/
|
||||
|
||||
import axios from 'axios';
|
||||
|
||||
const API_URL = 'http://localhost:5000/api';
|
||||
|
||||
async function testSearch() {
|
||||
try {
|
||||
console.log('Testing /emails/search-jmap endpoint...\n');
|
||||
|
||||
// You'll need to replace this with a valid session cookie
|
||||
// Get it from browser DevTools after logging in
|
||||
const cookie = process.env.TEST_COOKIE || '';
|
||||
|
||||
if (!cookie) {
|
||||
console.error('❌ Please set TEST_COOKIE environment variable');
|
||||
console.log(' Get it from browser DevTools > Application > Cookies');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const response = await axios.get(`${API_URL}/emails/search-jmap`, {
|
||||
params: {
|
||||
query: 'test',
|
||||
limit: 10,
|
||||
offset: 0,
|
||||
},
|
||||
headers: {
|
||||
Cookie: cookie,
|
||||
},
|
||||
});
|
||||
|
||||
console.log('✅ Success!');
|
||||
console.log('Status:', response.status);
|
||||
console.log('Data:', JSON.stringify(response.data, null, 2));
|
||||
} catch (error) {
|
||||
console.error('❌ Error:', error.response?.data || error.message);
|
||||
console.error('Status:', error.response?.status);
|
||||
}
|
||||
}
|
||||
|
||||
testSearch();
|
||||
Reference in New Issue
Block a user