Untuck tests out of __tests__ directories, colocate with program files

This commit is contained in:
Alex Gleason
2023-10-02 14:27:40 -05:00
parent 645ce60a5f
commit 3f640e9797
160 changed files with 223 additions and 681 deletions

View File

@ -2,7 +2,7 @@ import { AccountRecord } from 'soapbox/normalizers';
import {
getDomain,
} from '../accounts';
} from './accounts';
import type { ReducerAccount } from 'soapbox/reducers/accounts';

View File

@ -6,7 +6,7 @@ import {
filterBadges,
getTagDiff,
getBadges,
} from '../badges';
} from './badges';
test('tagToBadge', () => {
expect(tagToBadge('yolo')).toEqual('badge:yolo');

View File

@ -1,4 +1,4 @@
import * as base64 from '../base64';
import * as base64 from './base64';
describe('base64', () => {
describe('decode', () => {

View File

@ -3,7 +3,7 @@ import { normalizeChatMessage } from 'soapbox/normalizers';
import { ChatKeys, IChat } from 'soapbox/queries/chats';
import { queryClient } from 'soapbox/queries/client';
import { updateChatMessage } from '../chats';
import { updateChatMessage } from './chats';
const chat: IChat = {
accepted: true,

View File

@ -1,4 +1,4 @@
import tintify from '../colors';
import tintify from './colors';
const AZURE = '#0482d8';

View File

@ -1,4 +1,4 @@
import { compareId } from '../comparators';
import { compareId } from './comparators';
test('compareId', () => {
expect(compareId('3', '3')).toBe(0);

View File

@ -2,7 +2,7 @@ import { List as ImmutableList, fromJS } from 'immutable';
import config_db from 'soapbox/__fixtures__/config_db.json';
import { ConfigDB } from '../config-db';
import { ConfigDB } from './config-db';
test('find', () => {
const configs = fromJS(config_db).get('configs');

View File

@ -10,7 +10,7 @@ import {
getReactForStatus,
simulateEmojiReact,
simulateUnEmojiReact,
} from '../emoji-reacts';
} from './emoji-reacts';
const ALLOWED_EMOJI = ImmutableList([
'👍',

View File

@ -1,7 +1,7 @@
import {
removeVS16s,
toCodePoints,
} from '../emoji';
} from './emoji';
const ASCII_HEART = '❤'; // '\u2764\uFE0F'
const RED_HEART_RGI = '❤️'; // '\u2764'

View File

@ -3,7 +3,7 @@ import { buildInstance } from 'soapbox/jest/factory';
import {
parseVersion,
getFeatures,
} from '../features';
} from './features';
describe('parseVersion', () => {
it('with Pleroma version string', () => {

View File

@ -1,4 +1,4 @@
import * as html from '../html';
import * as html from './html';
describe('html', () => {
describe('unsecapeHTML', () => {

View File

@ -1,4 +1,4 @@
import { normalizeUsername } from '../input';
import { normalizeUsername } from './input';
test('normalizeUsername', () => {
expect(normalizeUsername('@alex')).toBe('alex');

View File

@ -1,4 +1,4 @@
import { addAutoPlay } from '../media';
import { addAutoPlay } from './media';
describe('addAutoPlay()', () => {
describe('when the provider is Rumble', () => {

View File

@ -1,7 +1,8 @@
import React from 'react';
import { render, screen } from '../../jest/test-helpers';
import { isIntegerId, secondsToDays, shortNumberFormat } from '../numbers';
import { render, screen } from 'soapbox/jest/test-helpers';
import { isIntegerId, secondsToDays, shortNumberFormat } from './numbers';
test('isIntegerId()', () => {
expect(isIntegerId('0')).toBe(true);

View File

@ -2,7 +2,7 @@ import { InfiniteData } from '@tanstack/react-query';
import { queryClient } from 'soapbox/queries/client';
import { PaginatedResult, sortQueryData, updatePageItem } from '../queries';
import { PaginatedResult, sortQueryData, updatePageItem } from './queries';
interface Item {
id: number;

View File

@ -4,7 +4,7 @@ import { buildStatus } from 'soapbox/jest/factory';
import {
hasIntegerMediaIds,
defaultMediaVisibility,
} from '../status';
} from './status';
describe('hasIntegerMediaIds()', () => {
it('returns true for a Pleroma deleted status', () => {

View File

@ -1,6 +1,6 @@
import { Map as ImmutableMap } from 'immutable';
import { toTailwind, fromLegacyColors, expandPalette } from '../tailwind';
import { toTailwind, fromLegacyColors, expandPalette } from './tailwind';
describe('toTailwind()', () => {
it('handles empty Soapbox config', () => {

View File

@ -2,7 +2,7 @@ import { fromJS } from 'immutable';
import { buildStatus } from 'soapbox/jest/factory';
import { shouldFilter } from '../timelines';
import { shouldFilter } from './timelines';
describe('shouldFilter', () => {
it('returns false under normal circumstances', () => {