Skip to content

Commit d8f6877

Browse files
committed
Adding missing babel plugin into packege.json, adding test for urls
1 parent 28101ff commit d8f6877

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
],
2525
"devDependencies": {
2626
"babel": "^6.3.13",
27+
"babel-eslint": "^4.1.4",
2728
"babel-plugin-external-helpers-2": "^6.1.4",
2829
"babel-plugin-syntax-async-functions": "^6.0.14",
2930
"babel-plugin-syntax-class-properties": "^6.0.14",
@@ -38,7 +39,7 @@
3839
"babel-plugin-transform-es2015-constants": "^6.0.15",
3940
"babel-plugin-transform-es2015-destructuring": "^6.0.18",
4041
"babel-plugin-transform-es2015-for-of": "^6.0.14",
41-
"babel-plugin-transform-es2015-modules-commonjs": "^6.1.3",
42+
"babel-plugin-transform-es2015-modules-commonjs": "6.26.0",
4243
"babel-plugin-transform-es2015-parameters": "^6.0.18",
4344
"babel-plugin-transform-es2015-shorthand-properties": "^6.0.14",
4445
"babel-plugin-transform-es2015-spread": "^6.0.14",
@@ -50,7 +51,6 @@
5051
"babel-plugin-transform-react-jsx": "^6.0.18",
5152
"babel-plugin-transform-regenerator": "^6.0.18",
5253
"babel-register": "^6.3.13",
53-
"babel-eslint": "^4.1.4",
5454
"chai": "^3.4.0",
5555
"eslint": "^1.8.0",
5656
"eslint-plugin-react": "^3.7.1",
@@ -59,6 +59,7 @@
5959
"author": "jrichardlai",
6060
"license": "MIT",
6161
"dependencies": {
62+
"babel-plugin-check-es2015-constants": "6.22.0",
6263
"prop-types": "^15.5.10"
6364
}
6465
}

test/TextExtraction.test.js

+18
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,24 @@ describe('TextExtraction', () => {
4242
]);
4343
});
4444

45+
it('return all matched urls', () => {
46+
const urls = [
47+
'https://website.bz',
48+
'http://website2.it',
49+
'https://t.co/hashKey',
50+
]
51+
const textExtraction = new TextExtraction(
52+
`this is my website ${urls[0]} and this is also ${urls[1]} ig this one also ${urls[2]}`,
53+
[{ pattern: /(https?:\/\/|www\.)[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-z]{1,6}\b([-a-zA-Z0-9@:%_\+.~#?&\/\/=]*)/i }]
54+
)
55+
56+
const parsedText = textExtraction.parse();
57+
expect(parsedText[1].children).to.eql(urls[0])
58+
expect(parsedText[3].children).to.eql(urls[1])
59+
expect(parsedText[5].children).to.eql(urls[2])
60+
61+
})
62+
4563
it('pass the values to the callbacks', (done) => {
4664
const textExtraction = new TextExtraction('hello foo', [
4765
{ pattern: /foo/, onPress: (value) => expect(value).to.eql('foo') && done() },

0 commit comments

Comments
 (0)