Merge remote-tracking branch 'origin/main' into lexical

This commit is contained in:
Alex Gleason
2023-09-20 19:13:16 -05:00
15 changed files with 220 additions and 617 deletions

View File

@@ -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');
});
});

View File

@@ -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');
});
});