File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ /**
2+ * This eslint rule is disabled because of https://github.com/nodesecurity/eslint-plugin-security/issues/21
3+ * It gives linting errors in testing the DB data with keys from fixtures
4+ */
5+ /* eslint-disable security/detect-object-injection */
6+
7+ const chai = require ( "chai" ) ;
8+ const { expect } = chai ;
9+ const cleanDb = require ( "../../utils/cleanDb" ) ;
10+ const profileDiffsQuery = require ( "../../../models/profileDiffs" ) ;
11+ const getProfileDiffs = require ( "../../fixtures/profileDiffs/profileDiffs" ) ;
12+
13+ describe ( "profileDiffs" , function ( ) {
14+ afterEach ( async function ( ) {
15+ await cleanDb ( ) ;
16+ } ) ;
17+
18+ describe ( "fetchProfileDiffUnobfuscated" , function ( ) {
19+ it ( "should return profileDiffs with unobfuscated email and phone" , async function ( ) {
20+ const profileDiffs = getProfileDiffs ( ) ;
21+ const profileDiffId = await profileDiffsQuery . add ( profileDiffs [ 0 ] ) ;
22+ const diff = await profileDiffsQuery . fetchProfileDiffUnobfuscated ( profileDiffId ) ;
23+ expect ( diff . phone ) . to . match ( / ^ ( \+ \d { 1 , 3 } [ - ] ? ) ? \d { 7 , 10 } $ / ) ;
24+ expect ( diff . email ) . to . match ( / ^ ( [ A - Z 0 - 9 _ + - ] + \. ? ) * [ A - Z 0 - 9 _ + - ] @ ( [ A - Z 0 - 9 ] [ A - Z 0 - 9 - ] * \. ) + [ A - Z ] { 2 , } $ / i) ;
25+ } ) ;
26+ } ) ;
27+ } ) ;
You can’t perform that action at this time.
0 commit comments