aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-03-10 08:52:11 +0800
committerMatthew Shao <me@matshao.com>2017-03-10 08:52:11 +0800
commitda93525d2e1922ed393e6f273e7df1226768df12 (patch)
tree2f6e36ab7d3483429d4096af5b241bb4263949b7
parent98b589385519eb6b27f8be89bb1ba45940d45245 (diff)
downloadmitmproxy-da93525d2e1922ed393e6f273e7df1226768df12.tar.gz
mitmproxy-da93525d2e1922ed393e6f273e7df1226768df12.tar.bz2
mitmproxy-da93525d2e1922ed393e6f273e7df1226768df12.zip
[web] remove the tests for abandoned files.
-rw-r--r--web/src/js/__tests__/ducks/flowViewSpec.js67
-rw-r--r--web/src/js/__tests__/ducks/utils/listSpec.js64
-rw-r--r--web/src/js/__tests__/ducks/utils/viewSpec.js156
3 files changed, 0 insertions, 287 deletions
diff --git a/web/src/js/__tests__/ducks/flowViewSpec.js b/web/src/js/__tests__/ducks/flowViewSpec.js
deleted file mode 100644
index d5d9a6d9..00000000
--- a/web/src/js/__tests__/ducks/flowViewSpec.js
+++ /dev/null
@@ -1,67 +0,0 @@
-jest.unmock('../../ducks/flows')
-jest.unmock('../../ducks/flowView')
-jest.unmock('../../ducks/utils/view')
-jest.unmock('../../ducks/utils/list')
-jest.unmock('./tutils')
-
-import { createStore } from './tutils'
-
-import flows, * as flowActions from '../../ducks/flows'
-import flowView, * as flowViewActions from '../../ducks/flowView'
-
-
-function testStore() {
- let store = createStore({
- flows,
- flowView
- })
- for (let i of [1, 2, 3, 4]) {
- store.dispatch(
- flowActions.addFlow({ id: i })
- )
- }
- return store
-}
-
-describe('select relative', () => {
-
- function testSelect(start, relative, result) {
- const store = testStore()
- store.dispatch(flowActions.select(start))
- expect(store.getState().flows.selected).toEqual(start ? [start] : [])
- store.dispatch(flowViewActions.selectRelative(relative))
- expect(store.getState().flows.selected).toEqual([result])
- }
-
- describe('previous', () => {
-
- it('should select the previous flow', () => {
- testSelect(3, -1, 2)
- })
-
- it('should not changed when first flow is selected', () => {
- testSelect(1, -1, 1)
- })
-
- it('should select first flow if no flow is selected', () => {
- testSelect(undefined, -1, 1)
- })
-
- })
-
- describe('next', () => {
-
- it('should select the next flow', () => {
- testSelect(2, 1, 3)
- })
-
- it('should not changed when last flow is selected', () => {
- testSelect(4, 1, 4)
- })
-
- it('should select last flow if no flow is selected', () => {
- testSelect(undefined, 1, 4)
- })
-
- })
-})
diff --git a/web/src/js/__tests__/ducks/utils/listSpec.js b/web/src/js/__tests__/ducks/utils/listSpec.js
deleted file mode 100644
index 0f5d0f34..00000000
--- a/web/src/js/__tests__/ducks/utils/listSpec.js
+++ /dev/null
@@ -1,64 +0,0 @@
-jest.unmock('lodash')
-jest.unmock('../../../ducks/utils/list')
-
-import reduce, * as list from '../../../ducks/utils/list'
-import _ from 'lodash'
-
-describe('list reduce', () => {
-
- it('should add item', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 },
- { id: 2 },
- { id: 3 }
- ])
- expect(reduce(state, list.add({ id: 3 }))).toEqual(result)
- })
-
- it('should update item', () => {
- const state = createState([
- { id: 1, val: 1 },
- { id: 2, val: 2 }
- ])
- const result = createState([
- { id: 1, val: 1 },
- { id: 2, val: 3 }
- ])
- expect(reduce(state, list.update({ id: 2, val: 3 }))).toEqual(result)
- })
-
- it('should remove item', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 }
- ])
- result.byId[2] = result.indexOf[2] = null
- expect(reduce(state, list.remove(2))).toEqual(result)
- })
-
- it('should replace all items', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 }
- ])
- expect(reduce(state, list.receive([{ id: 1 }]))).toEqual(result)
- })
-})
-
-function createState(items) {
- return {
- data: items,
- byId: _.fromPairs(items.map((item, index) => [item.id, item])),
- indexOf: _.fromPairs(items.map((item, index) => [item.id, index]))
- }
-}
diff --git a/web/src/js/__tests__/ducks/utils/viewSpec.js b/web/src/js/__tests__/ducks/utils/viewSpec.js
deleted file mode 100644
index af3da173..00000000
--- a/web/src/js/__tests__/ducks/utils/viewSpec.js
+++ /dev/null
@@ -1,156 +0,0 @@
-jest.unmock('../../../ducks/utils/view')
-jest.unmock('lodash')
-
-import reduce, * as view from '../../../ducks/utils/view'
-import _ from 'lodash'
-
-describe('view reduce', () => {
-
- it('should filter items', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 }
- ])
- expect(reduce(state, view.updateFilter(state.data, item => item.id === 1))).toEqual(result)
- })
-
- it('should sort items', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 2 },
- { id: 1 }
- ])
- expect(reduce(state, view.updateSort((a, b) => b.id - a.id))).toEqual(result)
- })
-
- it('should add item', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 },
- { id: 2 },
- { id: 3 }
- ])
- expect(reduce(state, view.add({ id: 3 }))).toEqual(result)
- })
-
- it('should add item in place', () => {
- const state = createState([
- { id: 1 }
- ])
- const result = createState([
- { id: 3 },
- { id: 1 }
- ])
- expect(reduce(state, view.add({ id: 3 }, undefined, (a, b) => b.id - a.id))).toEqual(result)
- })
-
- it('should filter added item', () => {
- const state = createState([
- { id: 1 }
- ])
- const result = createState([
- { id: 1 }
- ])
- expect(reduce(state, view.add({ id: 3 }, i => i.id === 1))).toEqual(result)
- })
-
- it('should update item', () => {
- const state = createState([
- { id: 1, val: 1 },
- { id: 2, val: 2 },
- { id: 3, val: 3 }
- ])
- const result = createState([
- { id: 1, val: 1 },
- { id: 2, val: 3 },
- { id: 3, val: 3 }
- ])
- expect(reduce(state, view.update({ id: 2, val: 3 }))).toEqual(result)
- })
-
- it('should sort updated item', () => {
- const state = createState([
- { id: 1, val: 1 },
- { id: 2, val: 2 }
- ])
- const result = createState([
- { id: 2, val: 3 },
- { id: 1, val: 1 }
- ])
- expect(reduce(state, view.update({ id: 2, val: 3 }, undefined, (a, b) => b.id - a.id))).toEqual(result)
- })
-
- it('should filter updated item', () => {
- const state = createState([
- { id: 1, val: 1 },
- { id: 2, val: 2 }
- ])
- const result = createState([
- { id: 1, val: 1 }
- ])
- result.indexOf[2] = null
- expect(reduce(state, view.update({ id: 2, val: 3 }, i => i.id === i.val))).toEqual(result)
- })
-
- it('should remove item', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 }
- ])
- result.indexOf[2] = null
- expect(reduce(state, view.remove(2))).toEqual(result)
- })
-
- it('should replace items', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 }
- ])
- expect(reduce(state, view.receive([{ id: 1 }]))).toEqual(result)
- })
-
- it('should sort received items', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 2 },
- { id: 1 }
- ])
- expect(reduce(state, view.receive([{ id: 1 }, { id: 2 }], undefined, (a, b) => b.id - a.id))).toEqual(result)
- })
-
- it('should filter received', () => {
- const state = createState([
- { id: 1 },
- { id: 2 }
- ])
- const result = createState([
- { id: 1 }
- ])
- expect(reduce(state, view.receive([{ id: 1 }, { id: 2 }], i => i.id === 1))).toEqual(result)
- })
-})
-
-function createState(items) {
- return {
- data: items,
- indexOf: _.fromPairs(items.map((item, index) => [item.id, index]))
- }
-}