From 1fc2db85fa339f9b134d45c15d2ad4cf3d681070 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Thu, 16 Jun 2016 03:06:08 -0700 Subject: web: fix tests --- web/package.json | 18 ++++++++---------- web/src/js/__tests__/utils.js | 15 +++++++++++++++ web/src/js/tests/utils.js | 16 ---------------- 3 files changed, 23 insertions(+), 26 deletions(-) create mode 100644 web/src/js/__tests__/utils.js delete mode 100644 web/src/js/tests/utils.js diff --git a/web/package.json b/web/package.json index 97a5ad3e..54555cb1 100644 --- a/web/package.json +++ b/web/package.json @@ -2,18 +2,16 @@ "name": "mitmproxy", "private": true, "scripts": { - "test": "jest ./src/js" + "test": "jest" }, "jest": { - "scriptPreprocessor": "/node_modules/babel-jest", "testPathDirs": [ - "./src/js" + "/src/js" ], - "testPathIgnorePatterns": [ - "/node_modules/", - "testutils.js" - ], - "testDirectoryName": "tests" + "unmockedModulePathPatterns": [ + "react", + "jquery" + ] }, "dependencies": { "bootstrap": "^3.3.6", @@ -33,7 +31,7 @@ "devDependencies": { "babel-core": "^6.7.7", "babel-eslint": "^6.0.4", - "babel-jest": "^12.0.2", + "babel-jest": "^12.1.0", "babel-plugin-transform-class-properties": "^6.6.0", "babel-plugin-transform-object-rest-spread": "^6.8.0", "babel-preset-es2015": "^6.6.0", @@ -52,7 +50,7 @@ "gulp-rename": "^1.2.2", "gulp-sourcemaps": "^1.6.0", "gulp-util": "^3.0.7", - "jest": "^0.1.40", + "jest": "^12.1.1", "uglifyify": "^3.0.1", "vinyl-buffer": "^1.0.0", "vinyl-source-stream": "^1.1.0", diff --git a/web/src/js/__tests__/utils.js b/web/src/js/__tests__/utils.js new file mode 100644 index 00000000..eda740a1 --- /dev/null +++ b/web/src/js/__tests__/utils.js @@ -0,0 +1,15 @@ +jest.unmock("../utils.js"); + +import {formatSize} from "../utils.js" + +describe("utils", function () { + it("formatSize", function(){ + expect(formatSize(1024)).toEqual("1kb"); + expect(formatSize(0)).toEqual("0"); + expect(formatSize(10)).toEqual("10b"); + expect(formatSize(1025)).toEqual("1.0kb"); + expect(formatSize(1024*1024)).toEqual("1mb"); + expect(formatSize(1024*1024+1)).toEqual("1.0mb"); + }); +}); + diff --git a/web/src/js/tests/utils.js b/web/src/js/tests/utils.js deleted file mode 100644 index acbadc92..00000000 --- a/web/src/js/tests/utils.js +++ /dev/null @@ -1,16 +0,0 @@ -jest.dontMock("jquery"); -jest.dontMock("../utils"); - -import {formatSize} from "../utils.js" - -describe("utils", function () { - it("formatSize", function(){ - expect(formatSize(1024)).toEqual("1kb"); - expect(formatSize(0)).toEqual("0"); - expect(formatSize(10)).toEqual("10b"); - expect(formatSize(1025)).toEqual("1.0kb"); - expect(formatSize(1024*1024)).toEqual("1mb"); - expect(formatSize(1024*1024+1)).toEqual("1.0mb"); - }); -}); - -- cgit v1.2.3