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