feat(api): s/jest/vitest/g (#61863)

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
Co-authored-by: Shaun Hamilton <shauhami020@gmail.com>
This commit is contained in:
Mrugesh Mohapatra
2025-08-25 22:57:56 +05:30
committed by GitHub
parent fed489f092
commit 45c098d506
58 changed files with 1974 additions and 907 deletions

View File

@@ -1,6 +1,14 @@
import {
describe,
test,
expect,
beforeAll,
beforeEach,
afterAll
} from 'vitest';
import Fastify, { FastifyInstance } from 'fastify';
import { checkCanConnectToDb, defaultUserEmail } from '../../jest.utils';
import { checkCanConnectToDb, defaultUserEmail } from '../../vitest.utils';
import { HOME_LOCATION } from '../utils/env';
import { devAuth } from '../plugins/auth-dev';
import prismaPlugin from '../db/prisma';
@@ -36,7 +44,7 @@ describe('dev login', () => {
});
describe('GET /signin', () => {
it('should create an account if one does not exist', async () => {
test('should create an account if one does not exist', async () => {
const before = await fastify.prisma.user.count({});
await fastify.inject({
method: 'GET',
@@ -49,7 +57,7 @@ describe('dev login', () => {
expect(after).toBe(before + 1);
});
it('should populate the user with the correct data', async () => {
test('should populate the user with the correct data', async () => {
await fastify.inject({
method: 'GET',
url: '/signin'
@@ -63,7 +71,7 @@ describe('dev login', () => {
expect(user.username).toBe(user.usernameDisplay);
});
it('should set the jwt_access_token cookie', async () => {
test('should set the jwt_access_token cookie', async () => {
const res = await fastify.inject({
method: 'GET',
url: '/signin'
@@ -78,9 +86,9 @@ describe('dev login', () => {
);
});
it.todo('should create a session');
test.todo('should create a session');
it('should redirect to the Referer (if it is a valid origin)', async () => {
test('should redirect to the Referer (if it is a valid origin)', async () => {
const res = await fastify.inject({
method: 'GET',
url: '/signin',
@@ -95,7 +103,7 @@ describe('dev login', () => {
);
});
it('should redirect to /valid-language/learn when signing in from /valid-language', async () => {
test('should redirect to /valid-language/learn when signing in from /valid-language', async () => {
const res = await fastify.inject({
method: 'GET',
url: '/signin',
@@ -110,7 +118,7 @@ describe('dev login', () => {
);
});
it('should handle referers with trailing slahes', async () => {
test('should handle referers with trailing slahes', async () => {
const res = await fastify.inject({
method: 'GET',
url: '/signin',
@@ -125,7 +133,7 @@ describe('dev login', () => {
);
});
it('should redirect to /learn by default', async () => {
test('should redirect to /learn by default', async () => {
const res = await fastify.inject({
method: 'GET',
url: '/signin'