mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-03-13 19:00:41 -04:00
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:
committed by
GitHub
parent
fed489f092
commit
45c098d506
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user