From 2f1a9eb2d09e40ad56d8d0e7d68ceaa04326b05c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Thu, 23 Oct 2025 18:27:42 +0200 Subject: [PATCH] pl-fe: remove tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- packages/pl-fe/src/actions/accounts.test.ts | 402 -------------------- 1 file changed, 402 deletions(-) diff --git a/packages/pl-fe/src/actions/accounts.test.ts b/packages/pl-fe/src/actions/accounts.test.ts index 3edbc65fb..3c1e628ca 100644 --- a/packages/pl-fe/src/actions/accounts.test.ts +++ b/packages/pl-fe/src/actions/accounts.test.ts @@ -6,14 +6,10 @@ import { mockStore, rootState } from 'pl-fe/jest/test-helpers'; import { normalizeAccount } from 'pl-fe/normalizers/account'; import { - blockAccount, createAccount, fetchAccount, fetchAccountByUsername, fetchRelationships, - muteAccount, - unblockAccount, - unmuteAccount, } from './accounts'; let store: ReturnType; @@ -376,404 +372,6 @@ describe('fetchAccountByUsername()', () => { }); }); -describe('blockAccount()', () => { - const id = '1'; - - describe('when logged out', () => { - beforeEach(() => { - const state = { ...rootState, me: null }; - store = mockStore(state); - }); - - it('should do nothing', async() => { - await store.dispatch(blockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual([]); - }); - }); - - describe('when logged in', () => { - beforeEach(() => { - const state = { ...rootState, me: '123' }; - store = mockStore(state); - }); - - describe('with a successful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/block`).reply(200, {}); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_BLOCK_REQUEST', id }, - { - type: 'ACCOUNT_BLOCK_SUCCESS', - relationship: {}, - statuses: ImmutableMap({}), - }, - ]; - await store.dispatch(blockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - - describe('with an unsuccessful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/block`).networkError(); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_BLOCK_REQUEST', id }, - { type: 'ACCOUNT_BLOCK_FAIL', error: new Error('Network Error') }, - ]; - await store.dispatch(blockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - }); -}); - -describe('unblockAccount()', () => { - const id = '1'; - - describe('when logged out', () => { - beforeEach(() => { - const state = { ...rootState, me: null }; - store = mockStore(state); - }); - - it('should do nothing', async() => { - await store.dispatch(unblockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual([]); - }); - }); - - describe('when logged in', () => { - beforeEach(() => { - const state = { ...rootState, me: '123' }; - store = mockStore(state); - }); - - describe('with a successful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/unblock`).reply(200, {}); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_UNBLOCK_REQUEST', id }, - { - type: 'ACCOUNT_UNBLOCK_SUCCESS', - relationship: {}, - }, - ]; - await store.dispatch(unblockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - - describe('with an unsuccessful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/unblock`).networkError(); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_UNBLOCK_REQUEST', id }, - { type: 'ACCOUNT_UNBLOCK_FAIL', error: new Error('Network Error') }, - ]; - await store.dispatch(unblockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - }); -}); - -describe('muteAccount()', () => { - const id = '1'; - - describe('when logged out', () => { - beforeEach(() => { - const state = { ...rootState, me: null }; - store = mockStore(state); - }); - - it('should do nothing', async() => { - await store.dispatch(unblockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual([]); - }); - }); - - describe('when logged in', () => { - beforeEach(() => { - const state = { ...rootState, me: '123' }; - store = mockStore(state); - }); - - describe('with a successful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/mute`).reply(200, {}); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_MUTE_REQUEST', id }, - { - type: 'ACCOUNT_MUTE_SUCCESS', - relationship: {}, - statuses: ImmutableMap({}), - }, - ]; - await store.dispatch(muteAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - - describe('with an unsuccessful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/mute`).networkError(); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_MUTE_REQUEST', id }, - { type: 'ACCOUNT_MUTE_FAIL', error: new Error('Network Error') }, - ]; - await store.dispatch(muteAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - }); -}); - -describe('unmuteAccount()', () => { - const id = '1'; - - describe('when logged out', () => { - beforeEach(() => { - const state = { ...rootState, me: null }; - store = mockStore(state); - }); - - it('should do nothing', async() => { - await store.dispatch(unblockAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual([]); - }); - }); - - describe('when logged in', () => { - beforeEach(() => { - const state = { ...rootState, me: '123' }; - store = mockStore(state); - }); - - describe('with a successful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/unmute`).reply(200, {}); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_UNMUTE_REQUEST', id }, - { - type: 'ACCOUNT_UNMUTE_SUCCESS', - relationship: {}, - }, - ]; - await store.dispatch(unmuteAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - - describe('with an unsuccessful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/accounts/${id}/unmute`).networkError(); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_UNMUTE_REQUEST', id }, - { type: 'ACCOUNT_UNMUTE_FAIL', error: new Error('Network Error') }, - ]; - await store.dispatch(unmuteAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - }); -}); - -describe('subscribeAccount()', () => { - const id = '1'; - - describe('when logged out', () => { - beforeEach(() => { - const state = { ...rootState, me: null }; - store = mockStore(state); - }); - - it('should do nothing', async() => { - await store.dispatch(subscribeAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual([]); - }); - }); - - describe('when logged in', () => { - beforeEach(() => { - const state = { ...rootState, me: '123' }; - store = mockStore(state); - }); - - describe('with a successful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/pleroma/accounts/${id}/subscribe`).reply(200, {}); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_SUBSCRIBE_REQUEST', id }, - { - type: 'ACCOUNT_SUBSCRIBE_SUCCESS', - relationship: {}, - }, - ]; - await store.dispatch(subscribeAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - - describe('with an unsuccessful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/pleroma/accounts/${id}/subscribe`).networkError(); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_SUBSCRIBE_REQUEST', id }, - { type: 'ACCOUNT_SUBSCRIBE_FAIL', error: new Error('Network Error') }, - ]; - await store.dispatch(subscribeAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - }); -}); - -describe('unsubscribeAccount()', () => { - const id = '1'; - - describe('when logged out', () => { - beforeEach(() => { - const state = { ...rootState, me: null }; - store = mockStore(state); - }); - - it('should do nothing', async() => { - await store.dispatch(subscribeAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual([]); - }); - }); - - describe('when logged in', () => { - beforeEach(() => { - const state = { ...rootState, me: '123' }; - store = mockStore(state); - }); - - describe('with a successful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/pleroma/accounts/${id}/unsubscribe`).reply(200, {}); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_UNSUBSCRIBE_REQUEST', id }, - { - type: 'ACCOUNT_UNSUBSCRIBE_SUCCESS', - relationship: {}, - }, - ]; - await store.dispatch(unsubscribeAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - - describe('with an unsuccessful API request', () => { - beforeEach(() => { - __stub((mock) => { - mock.onPost(`/api/v1/pleroma/accounts/${id}/unsubscribe`).networkError(); - }); - }); - - it('should dispatch the correct actions', async() => { - const expectedActions = [ - { type: 'ACCOUNT_UNSUBSCRIBE_REQUEST', id }, - { type: 'ACCOUNT_UNSUBSCRIBE_FAIL', error: new Error('Network Error') }, - ]; - await store.dispatch(unsubscribeAccount(id)); - const actions = store.getActions(); - - expect(actions).toEqual(expectedActions); - }); - }); - }); -}); - describe('fetchRelationships()', () => { const id = '1';