Skip to content

Commit 4307524

Browse files
committed
Improved testing
Signed-off-by: Jaid <jaid.jsx@gmail.com>
1 parent bfd131e commit 4307524

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"clean": "rimraf dist dist-jsdoc",
3232
"build:prod": "cross-env NODE_ENV=production webpack",
3333
"build:dev": "webpack",
34-
"test": "npm run build:prod && jest",
34+
"test": "jest && npm run build:prod && cross-env MAIN=dist jest",
3535
"test:dev": "npm run build:dev && jest",
3636
"test:debug": "node --inspect=9229 node_modules/jest/bin/jest.js --runInBand",
3737
"release": "npm run build:prod && npm publish dist && cross-env git tag v$npm_package_version && git push --tags && cross-env opn https://github.com/$npm_package_author_name/$(basename $PWD)/releases/new?tag=v$npm_package_version"

src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
/** @module array-to-object-keys */
2+
23
/**
34
* @typedef valueGenerator
45
* @type {function}
56
* @param {string} value The original array entry
67
* @param {number} index The index of the array entry (starts at 0)
78
* @returns {*}
89
*/
10+
911
/**
1012
* Converts an array to an object with static keys and customizable values
1113
* @example

test/index.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
import arrayToObjectKeys from "../dist"
1+
import path from "path"
2+
3+
const indexModule = (process.env.MAIN ? path.resolve(process.env.MAIN) : path.join(__dirname, "..", "src")) |> require
4+
const {default: arrayToObjectKeys} = indexModule
25

36
it("should run with 1 argument", () => {
47
const result = arrayToObjectKeys(["a", "b"])

0 commit comments

Comments
 (0)