Merge remote-tracking branch 'origin/main' into lexical
This commit is contained in:
commit
77d18e9cd3
15 changed files with 220 additions and 617 deletions
|
@ -190,6 +190,7 @@
|
|||
"@testing-library/react": "^14.0.0",
|
||||
"@testing-library/react-hooks": "^8.0.1",
|
||||
"@testing-library/user-event": "^14.5.1",
|
||||
"@types/yargs": "^17.0.24",
|
||||
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
||||
"@typescript-eslint/parser": "^6.0.0",
|
||||
"babel-plugin-transform-require-context": "^0.1.1",
|
||||
|
@ -214,6 +215,7 @@
|
|||
"stylelint": "^15.10.3",
|
||||
"stylelint-config-standard-scss": "^11.0.0",
|
||||
"tailwindcss": "^3.3.3",
|
||||
"vite-plugin-checker": "^0.6.2",
|
||||
"vite-plugin-pwa": "^0.16.5",
|
||||
"vitest": "^0.34.4",
|
||||
"yargs": "^17.6.2"
|
||||
|
|
|
@ -4,7 +4,7 @@ import { mockStore, rootState } from 'soapbox/jest/test-helpers';
|
|||
import { fetchRules, RULES_FETCH_REQUEST, RULES_FETCH_SUCCESS } from '../rules';
|
||||
|
||||
describe('fetchRules()', () => {
|
||||
it('sets the rules', (done) => {
|
||||
it('sets the rules', async () => {
|
||||
const rules = require('soapbox/__fixtures__/rules.json');
|
||||
|
||||
__stub((mock) => {
|
||||
|
@ -12,15 +12,12 @@ describe('fetchRules()', () => {
|
|||
});
|
||||
|
||||
const store = mockStore(rootState);
|
||||
await store.dispatch(fetchRules());
|
||||
|
||||
store.dispatch(fetchRules()).then((context) => {
|
||||
const actions = store.getActions();
|
||||
const actions = store.getActions();
|
||||
|
||||
expect(actions[0].type).toEqual(RULES_FETCH_REQUEST);
|
||||
expect(actions[1].type).toEqual(RULES_FETCH_SUCCESS);
|
||||
expect(actions[1].payload[0].id).toEqual('1');
|
||||
|
||||
done();
|
||||
}).catch(console.error);
|
||||
expect(actions[0].type).toEqual(RULES_FETCH_REQUEST);
|
||||
expect(actions[1].type).toEqual(RULES_FETCH_SUCCESS);
|
||||
expect(actions[1].payload[0].id).toEqual('1');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,7 +8,7 @@ import { normalizeStatus } from 'soapbox/normalizers/status';
|
|||
import { deleteStatus, fetchContext } from '../statuses';
|
||||
|
||||
describe('fetchContext()', () => {
|
||||
it('handles Mitra context', done => {
|
||||
it('handles Mitra context', async () => {
|
||||
const statuses = require('soapbox/__fixtures__/mitra-context.json');
|
||||
|
||||
__stub(mock => {
|
||||
|
@ -17,15 +17,11 @@ describe('fetchContext()', () => {
|
|||
});
|
||||
|
||||
const store = mockStore(rootState);
|
||||
await store.dispatch(fetchContext('017ed505-5926-392f-256a-f86d5075df70'));
|
||||
const actions = store.getActions();
|
||||
|
||||
store.dispatch(fetchContext('017ed505-5926-392f-256a-f86d5075df70')).then(() => {
|
||||
const actions = store.getActions();
|
||||
|
||||
expect(actions[3].type).toEqual(STATUSES_IMPORT);
|
||||
expect(actions[3].statuses[0].id).toEqual('017ed503-bc96-301a-e871-2c23b30ddd05');
|
||||
|
||||
done();
|
||||
}).catch(console.error);
|
||||
expect(actions[3].type).toEqual(STATUSES_IMPORT);
|
||||
expect(actions[3].statuses[0].id).toEqual('017ed503-bc96-301a-e871-2c23b30ddd05');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Header from '../header';
|
||||
|
@ -22,11 +22,4 @@ describe('<Header />', () => {
|
|||
expect(screen.getByText('Register')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('with registrations closed, Pepe enabled', () => {
|
||||
it('displays the signup button', () => {
|
||||
render(<Header />, undefined, storePepeOpen);
|
||||
expect(screen.getByText('Register')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeClosed, storeLoggedIn, storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { storeClosed, storeLoggedIn, storeOpen } from 'soapbox/jest/mock-stores';
|
||||
|
||||
import { render, screen } from '../../../../jest/test-helpers';
|
||||
import CtaBanner from '../cta-banner';
|
||||
|
@ -24,11 +24,4 @@ describe('<CtaBanner />', () => {
|
|||
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
|
||||
});
|
||||
});
|
||||
|
||||
describe('with Pepe enabled', () => {
|
||||
it('renders the banner', () => {
|
||||
render(<CtaBanner />, undefined, storePepeOpen);
|
||||
expect(screen.getByTestId('cta-banner')).toHaveTextContent(/sign up/i);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import Navbar from '../navbar';
|
||||
|
@ -22,11 +22,4 @@ describe('<Navbar />', () => {
|
|||
expect(screen.getByText('Sign up')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('with registrations closed, Pepe enabled', () => {
|
||||
it('displays the signup button', () => {
|
||||
render(<Navbar />, undefined, storePepeOpen);
|
||||
expect(screen.getByText('Sign up')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import LandingPageModal from '../landing-page-modal';
|
||||
|
@ -22,11 +22,4 @@ describe('<LandingPageModal />', () => {
|
|||
expect(screen.getByText('Register')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('with registrations closed, Pepe enabled', () => {
|
||||
it('displays the signup button', () => {
|
||||
render(<LandingPageModal onClose={vi.fn} />, undefined, storePepeOpen);
|
||||
expect(screen.getByText('Register')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import UnauthorizedModal from '../unauthorized-modal';
|
||||
|
@ -22,11 +22,4 @@ describe('<UnauthorizedModal />', () => {
|
|||
expect(screen.getByText('Sign up')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('with registrations closed, Pepe enabled', () => {
|
||||
it('displays the signup button', () => {
|
||||
render(<UnauthorizedModal onClose={vi.fn} action='FOLLOW' />, undefined, storePepeOpen);
|
||||
expect(screen.getByText('Sign up')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import React from 'react';
|
||||
|
||||
import { storeOpen, storePepeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { storeOpen } from 'soapbox/jest/mock-stores';
|
||||
import { render, screen } from 'soapbox/jest/test-helpers';
|
||||
|
||||
import SignUpPanel from '../sign-up-panel';
|
||||
|
@ -17,11 +17,4 @@ describe('<SignUpPanel />', () => {
|
|||
expect(screen.getByTestId('sign-up-panel')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe('with registrations closed, Pepe enabled', () => {
|
||||
it('successfully renders', () => {
|
||||
render(<SignUpPanel />, undefined, storePepeOpen);
|
||||
expect(screen.getByTestId('sign-up-panel')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ import { v4 as uuidv4 } from 'uuid';
|
|||
|
||||
import {
|
||||
accountSchema,
|
||||
adSchema,
|
||||
cardSchema,
|
||||
groupMemberSchema,
|
||||
groupRelationshipSchema,
|
||||
|
@ -11,7 +10,6 @@ import {
|
|||
relationshipSchema,
|
||||
statusSchema,
|
||||
type Account,
|
||||
type Ad,
|
||||
type Card,
|
||||
type Group,
|
||||
type GroupMember,
|
||||
|
@ -73,12 +71,6 @@ function buildGroupMember(
|
|||
}, props));
|
||||
}
|
||||
|
||||
function buildAd(props: PartialDeep<Ad> = {}): Ad {
|
||||
return adSchema.parse(Object.assign({
|
||||
card: buildCard(),
|
||||
}, props));
|
||||
}
|
||||
|
||||
function buildRelationship(props: PartialDeep<Relationship> = {}): Relationship {
|
||||
return relationshipSchema.parse(Object.assign({
|
||||
id: uuidv4(),
|
||||
|
@ -94,7 +86,6 @@ function buildStatus(props: PartialDeep<Status> = {}) {
|
|||
|
||||
export {
|
||||
buildAccount,
|
||||
buildAd,
|
||||
buildCard,
|
||||
buildGroup,
|
||||
buildGroupMember,
|
||||
|
|
|
@ -11,7 +11,6 @@ import { toTailwind } from 'soapbox/utils/tailwind';
|
|||
import { generateAccent } from 'soapbox/utils/theme';
|
||||
|
||||
import type {
|
||||
Ad,
|
||||
PromoPanelItem,
|
||||
FooterItem,
|
||||
CryptoAddress,
|
||||
|
@ -68,7 +67,6 @@ export const CryptoAddressRecord = ImmutableRecord({
|
|||
});
|
||||
|
||||
export const SoapboxConfigRecord = ImmutableRecord({
|
||||
ads: ImmutableList<Ad>(),
|
||||
appleAppId: null,
|
||||
authProvider: '',
|
||||
logo: '',
|
||||
|
|
|
@ -19,7 +19,3 @@ export {
|
|||
CryptoAddress,
|
||||
SoapboxConfig,
|
||||
};
|
||||
|
||||
export type {
|
||||
Ad,
|
||||
} from 'soapbox/schemas';
|
|
@ -12,6 +12,7 @@
|
|||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"paths": {
|
||||
"soapbox/*": ["src/*"],
|
||||
},
|
||||
|
|
|
@ -5,6 +5,7 @@ import { fileURLToPath, URL } from 'node:url';
|
|||
import react from '@vitejs/plugin-react';
|
||||
import { visualizer } from 'rollup-plugin-visualizer';
|
||||
import { defineConfig } from 'vite';
|
||||
import checker from 'vite-plugin-checker';
|
||||
import compileTime from 'vite-plugin-compile-time';
|
||||
import { createHtmlPlugin } from 'vite-plugin-html';
|
||||
import { VitePWA } from 'vite-plugin-pwa';
|
||||
|
@ -28,6 +29,7 @@ export default defineConfig({
|
|||
port: 3036,
|
||||
},
|
||||
plugins: [
|
||||
checker({ typescript: true }),
|
||||
// @ts-ignore
|
||||
vitePluginRequire.default(),
|
||||
compileTime(),
|
||||
|
|
Loading…
Reference in a new issue