@becollective/utils 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +2 -2
- package/package.json +14 -4
- package/password.js +9 -0
- package/rollup.config.js +20 -0
- package/tests/password.test.js +15 -0
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@becollective/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Common utilities",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "bundle.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"test": "NODE_ENV=localtest jest tests/*"
|
|
7
|
+
"test": "NODE_ENV=localtest ./node_modules/.bin/jest tests/*",
|
|
8
|
+
"build": "./node_modules/rollup/bin/rollup -c",
|
|
9
|
+
"prepush": "npm run build; npm test;"
|
|
8
10
|
},
|
|
9
11
|
"author": "",
|
|
10
|
-
"license": "ISC"
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@babel/core": "^7.1.6",
|
|
15
|
+
"@babel/preset-env": "^7.1.6",
|
|
16
|
+
"jest": "^23.6.0",
|
|
17
|
+
"rollup": "^0.67.1",
|
|
18
|
+
"rollup-plugin-babel": "^4.0.3",
|
|
19
|
+
"rollup-plugin-node-resolve": "^3.4.0"
|
|
20
|
+
}
|
|
11
21
|
}
|
package/password.js
CHANGED
package/rollup.config.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import resolve from 'rollup-plugin-node-resolve';
|
|
2
|
+
import babel from 'rollup-plugin-babel';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
input: 'index.js',
|
|
6
|
+
output: {
|
|
7
|
+
file: 'bundle.js',
|
|
8
|
+
format: 'cjs'
|
|
9
|
+
},
|
|
10
|
+
plugins: [
|
|
11
|
+
resolve(),
|
|
12
|
+
babel({
|
|
13
|
+
exclude: 'node_modules/**', // only transpile our source code
|
|
14
|
+
babelrc: false,
|
|
15
|
+
presets: [
|
|
16
|
+
"@babel/preset-env",
|
|
17
|
+
],
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
};
|
package/tests/password.test.js
CHANGED
|
@@ -52,4 +52,19 @@ describe('password.valiate', () => {
|
|
|
52
52
|
util.password.validate(password);
|
|
53
53
|
}).toThrow('not-string');
|
|
54
54
|
}, 1000);
|
|
55
|
+
test('returns false for invalid passwords', async () => {
|
|
56
|
+
const someValid = [
|
|
57
|
+
'short',
|
|
58
|
+
'1234567a',
|
|
59
|
+
'123456aa',
|
|
60
|
+
'1aB!',
|
|
61
|
+
]
|
|
62
|
+
.map(util.password.isValid)
|
|
63
|
+
.some(val => val);
|
|
64
|
+
expect(someValid).toBe(false);
|
|
65
|
+
});
|
|
66
|
+
test('returns true for a valid password', async () => {
|
|
67
|
+
const password = 'Password@123';
|
|
68
|
+
expect(util.password.isValid(password)).toBe(true);
|
|
69
|
+
});
|
|
55
70
|
});
|