Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix URLs as dependencies in package.json #793

Merged
merged 1 commit into from
Jan 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix URLs as dependencies in package.json
  • Loading branch information
Stefan Buck committed Jan 26, 2020
commit cb8dc894e0eb3d5c9ef6dd8c3b4892e16795d30b
8 changes: 7 additions & 1 deletion e2e/fixtures/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
},
"devDependencies": {
"//": "@OctoLinkerResolve(https://github.com/jashkenas/underscore)",
"underscore": "1.2.3"
"underscore": "1.2.3",
"//": "@OctoLinkerResolve(https://github.com/expressjs/express)",
"express": "expressjs/express",
"//": "@OctoLinkerResolve(https://github.com/mochajs/mocha/tree/v7.0.0)",
"mocha": "mochajs/mocha#v7.0.0",
"//": "@OctoLinkerResolve(https://github.com/angular/angular)",
"angular": "[email protected]:angular/angular.git"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,19 @@ Array [
},
]
`;

exports[`get-position returns an empty array when capture group is empty 1`] = `
Array [
Object {
"endPos": 3,
"endPosInBlob": 3,
"lineNumber": 1,
"startPos": 0,
"startPosInBlob": 0,
"values": Array [
"foo",
"bar",
],
},
]
`;
3 changes: 3 additions & 0 deletions packages/helper-insert-link/__tests__/get-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ describe('get-position', () => {
test('returns an empty array when capture group is empty', () => {
expect(getPosition('foo:bar', /foo:([0-9])?/g)).toStrictEqual([]);
});
test('returns an empty array when capture group is empty', () => {
expect(getPosition('foo:bar', /(foo):(bar)/g)).toMatchSnapshot();
});
});
2 changes: 1 addition & 1 deletion packages/helper-insert-link/get-position.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default function(blobString, regex) {
endPosInBlob,
startPos,
endPos,
values: [matchValueStriped],
values: [matchValueStriped, ...match.slice(2)],
};
})
.filter(Boolean);
Expand Down
1 change: 0 additions & 1 deletion packages/helper-insert-link/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ export default function(blob, regex, plugin, meta = {}) {
endPos = endPosInBlob;
}

// TODO push link el into matches along with the urls prop
const retEl = injectUrl(el, values[0], startPos, endPos);
if (retEl) {
matches.push({
Expand Down
12 changes: 6 additions & 6 deletions packages/helper-regex-builder/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ import { jsonRegExValue, jsonRegExKeyValue } from '../index';

describe('helper-regex-builder', () => {
it('jsonRegExValue', () => {
expect(jsonRegExValue('foo', 'bar')).toEqual(/"foo"\s*:\s*("bar")/g);
expect(jsonRegExValue('foo', 'bar', false)).toEqual(/"foo"\s*:\s*("bar")/g);
expect(jsonRegExValue('foo', 'bar', true)).toEqual(/"foo"\s*:\s*("bar")/g);
expect(jsonRegExValue('foo', 'bar')).toEqual(/"foo"\s*:\s*"(bar)"/g);
expect(jsonRegExValue('foo', 'bar', false)).toEqual(/"foo"\s*:\s*"(bar)"/g);
expect(jsonRegExValue('foo', 'bar', true)).toEqual(/"foo"\s*:\s*"(bar)"/g);
});

it('jsonRegExKeyValue', () => {
expect(jsonRegExKeyValue('foo', 'bar')).toEqual(/("foo")\s*:\s*("bar")/g);
expect(jsonRegExKeyValue('foo', 'bar')).toEqual(/("foo")\s*:\s*"(bar)"/g);
expect(jsonRegExKeyValue('foo', 'bar', false)).toEqual(
/("foo")\s*:\s*("bar")/g,
/("foo")\s*:\s*"(bar)"/g,
);
expect(jsonRegExKeyValue('foo', 'bar', true)).toEqual(
/("foo")\s*:\s*("bar")/g,
/("foo")\s*:\s*"(bar)"/g,
);
});
});
2 changes: 1 addition & 1 deletion packages/helper-regex-builder/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function regexBuilder(key, value, groupKey) {
}

const regexValue = escapeRegexString(value);
const valueField = `("${regexValue}")`;
const valueField = `"(${regexValue})"`;
return new RegExp(`${keyField}\\s*:\\s*${valueField}`, 'g');
}

Expand Down