import { config } from 'dotenv';
import { testClient } from 'hono/testing';
import { describe, expect, test } from 'vitest';
import app, { AppRoutes } from './app/api/[[...route]]/route';
describe('demo', () => {
config();
test('should work', async () => {
const client = testClient<AppRoutes>(app);
const res = await client.api.auth.login.$post(
{
json: {
email: 'test69999dqsdqs@gmail.com',
password: '#Password123',
},
},
{
init: {
credentials: 'include',
},
}
);
console.log(await res.json());
const res2 = await client.api.auth.me.$get(undefined, {
init: {
credentials: 'include',
},
});
//Work !
expect(res.status).toBe(201);
// 401 No cookies has been send
expect(res2.status).toBe(200);
});
});
import { config } from 'dotenv';
import { testClient } from 'hono/testing';
import { describe, expect, test } from 'vitest';
import app, { AppRoutes } from './app/api/[[...route]]/route';
describe('demo', () => {
config();
test('should work', async () => {
const client = testClient<AppRoutes>(app);
const res = await client.api.auth.login.$post(
{
json: {
email: 'test69999dqsdqs@gmail.com',
password: '#Password123',
},
},
{
init: {
credentials: 'include',
},
}
);
console.log(await res.json());
const res2 = await client.api.auth.me.$get(undefined, {
init: {
credentials: 'include',
},
});
//Work !
expect(res.status).toBe(201);
// 401 No cookies has been send
expect(res2.status).toBe(200);
});
});