Openverse is a search engine for openly-licensed media. This monorepo includes all application code.
Remove unused store modules (#863)
Olga Bulat771ebe7e98d4
diff --git a/src/constants/action-types.js b/src/constants/action-types.jsindex 714741acf..894f5b61c 100644--- a/src/constants/action-types.js+++ b/src/constants/action-types.js@@ -5,12 +5,10 @@ export const FETCH_IMAGE = 'FETCH_IMAGE'export const FETCH_MEDIA = 'FETCH_MEDIA'export const FETCH_SINGLE_MEDIA_TYPE = 'FETCH_SINGLE_MEDIA_TYPE'export const COPY_ATTRIBUTION = 'COPY_ATTRIBUTION'-export const REPORT_BUG = 'REPORT_BUG'export const HANDLE_MEDIA_ERROR = 'HANDLE_MEDIA_ERROR'export const TOGGLE_FILTER = 'TOGGLE_FILTER'export const UPDATE_SEARCH_TYPE = 'UPDATE_SEARCH_TYPE'export const HANDLE_NO_MEDIA = 'HANDLE_NO_MEDIA'-export const NOTIFICATION_ACTION = 'NOTIFICATION_ACTION'export const UPDATE_QUERY = 'UPDATE_QUERY'export const UPDATE_QUERY_FROM_FILTERS = 'UPDATE_QUERY_FROM_FILTERS'export const SET_SEARCH_STATE_FROM_URL = 'SET_SEARCH_STATE_FROM_URL'diff --git a/src/constants/mutation-types.js b/src/constants/mutation-types.jsindex 732aa3625..f9a5560af 100644--- a/src/constants/mutation-types.js+++ b/src/constants/mutation-types.js@@ -12,10 +12,6 @@ export const SET_IMAGE = 'SET_IMAGE'export const SET_MEDIA_PROVIDERS = 'SET_MEDIA_PROVIDERS'export const SET_PROVIDERS_FILTERS = 'SET_PROVIDERS_FILTERS'export const SET_MEDIA = 'SET_MEDIA'-export const REPORT_BUG_START = 'REPORT_BUG_START'-export const REPORT_BUG_END = 'REPORT_BUG_END'-export const REPORT_BUG_FAILED = 'REPORT_BUG_FAILED'-export const SET_SHOW_NOTIFICATION = 'SET_SHOW_NOTIFICATION'export const SET_EMBEDDED = 'SET_EMBEDDED'export const SET_REFERRED = 'SET_REFERRED'export const SET_SEARCH_TYPE = 'SET_SEARCH_TYPE'diff --git a/src/store/bug-report.js b/src/store/bug-report.jsdeleted file mode 100644index ffd68e339..000000000--- a/src/store/bug-report.js+++ /dev/null@@ -1,46 +0,0 @@-import BugReportService from '~/data/bug-report-service'-import { REPORT_BUG } from '~/constants/action-types'--import {- REPORT_BUG_START,- REPORT_BUG_END,- REPORT_BUG_FAILED,-} from '~/constants/mutation-types'--export const createActions = (bugReportService) => ({- [REPORT_BUG]({ commit }, params) {- commit(REPORT_BUG_START)- bugReportService- .reportBug(params)- .then(() => commit(REPORT_BUG_END))- .catch(() => commit(REPORT_BUG_FAILED))- },-})--export const actions = createActions(BugReportService)--export const state = () => ({- isReportingBug: false,- bugReported: false,- bugReportFailed: false,-})--export const mutations = {- [REPORT_BUG_START](_state) {- _state.isReportingBug = true- },- [REPORT_BUG_END](_state) {- _state.isReportingBug = false- _state.bugReported = true- },- [REPORT_BUG_FAILED](_state) {- _state.isReportingBug = false- _state.bugReportFailed = true- },-}--export default {- state,- mutations,- actions,-}diff --git a/src/store/report-content.js b/src/store/report-content.jsdeleted file mode 100644index e69de29bb..000000000diff --git a/test/unit/specs/store/bug-report.spec.js b/test/unit/specs/store/bug-report.spec.jsdeleted file mode 100644index ae082ef0e..000000000--- a/test/unit/specs/store/bug-report.spec.js+++ /dev/null@@ -1,106 +0,0 @@-import {- state,- mutations as BugReportMutations,- createActions,-} from '~/store/bug-report'-import {- REPORT_BUG_START,- REPORT_BUG_END,- REPORT_BUG_FAILED,-} from '~/constants/mutation-types'-import { REPORT_BUG } from '~/constants/action-types'--describe('Attribution Store', () => {- describe('actions', () => {- let serviceMock = null- let commitMock = null- let store = {}-- const data = {- name: 'Foo',- email: '[email protected]',- bug_description: 'FooBar',- browser_info: 'Foo browser',- }-- beforeEach(() => {- serviceMock = {- reportBug: jest.fn(),- }- commitMock = {- commit: jest.fn(),- }- serviceMock.reportBug.mockResolvedValue(1)- store = {- state: state(),- mutations: BugReportMutations,- actions: createActions(serviceMock),- }- })-- it('calls reportBug service', () => {- store.actions[REPORT_BUG](commitMock, data)-- expect(serviceMock.reportBug).toHaveBeenCalledWith(data)- })-- it('commits REPORT_BUG_START', () => {- store.actions.REPORT_BUG(commitMock, data)-- expect(commitMock.commit).toHaveBeenCalledWith(REPORT_BUG_START)- })-- it('commits REPORT_BUG_END', (done) => {- store.actions.REPORT_BUG(commitMock, data)-- setTimeout(() => {- expect(commitMock.commit).toHaveBeenCalledWith(REPORT_BUG_END)- done()- }, 10)- })-- it('commits REPORT_BUG_FAILED', (done) => {- const failedServiceMock = {- reportBug: jest.fn(),- }- store.actions = createActions(failedServiceMock)- failedServiceMock.reportBug.mockRejectedValue(1)- store.actions.REPORT_BUG(commitMock, data)-- setTimeout(() => {- expect(commitMock.commit).toHaveBeenCalledWith(REPORT_BUG_FAILED)- done()- }, 10)- })- })-- describe('mutations', () => {- let state = null- let mutations = null-- beforeEach(() => {- state = {}- mutations = BugReportMutations- })-- it('REPORT_BUG_START sets isReportingBug to true', () => {- mutations.REPORT_BUG_START(state)-- expect(state.isReportingBug).toBeTruthy()- })-- it('REPORT_BUG_END sets bugReported to true and isReportingBug to false', () => {- mutations.REPORT_BUG_END(state)-- expect(state.bugReported).toBeTruthy()- expect(state.isReportingBug).toBeFalsy()- })-- it('REPORT_BUG_FAILED sets bugReportFailed to true and isReportingBug to false', () => {- mutations.REPORT_BUG_FAILED(state)-- expect(state.bugReportFailed).toBeTruthy()- expect(state.isReportingBug).toBeFalsy()- })- })-})