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

Prefetch urls in background and insert "real" anchor links #543

Merged
merged 18 commits into from
Mar 11, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix tests
  • Loading branch information
Stefan Buck committed Mar 10, 2019
commit bb401464d9b32e9915326826ce67b500c1da8d20
25 changes: 8 additions & 17 deletions packages/helper-octolinker-api/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,18 @@ const response = JSON.stringify({

const data = [
{
link: '<a />',
urls: {
target: 'https://developer.mozilla.org/',
type: 'ping',
},
target: 'https://developer.mozilla.org/',
type: 'ping',
},
{
link: '<a />',
urls: {
registry: 'npm',
target: 'jquery',
type: 'registry',
},
registry: 'npm',
target: 'jquery',
type: 'registry',
},
{
link: '<a />',
urls: {
registry: 'npm',
target: 'i-do-not-exist',
type: 'registry',
},
registry: 'npm',
target: 'i-do-not-exist',
type: 'registry',
},
];

Expand Down
7 changes: 4 additions & 3 deletions packages/plugin-javascript/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ describe('javascript-universal', () => {
});

it("resolves 'module' to 'https://nodejs.org/api/modules.html'", () => {
expect(plugin.resolve(path, ['module'])).toBe(
'https://nodejs.org/api/modules.html',
);
expect(plugin.resolve(path, ['module'])).toEqual({
target: 'https://nodejs.org/api/modules.html',
type: 'trusted-url',
});
});

it("resolves './modules/es6.symbol' without stripping .symbol suffix", () => {
Expand Down
7 changes: 5 additions & 2 deletions packages/plugin-less/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import assert from 'assert';
import githubSearch from '@octolinker/resolver-github-search';
import Less from '../index';

describe('Less', () => {
Expand All @@ -9,7 +8,11 @@ describe('Less', () => {
it('resolves links', () => {
assert.deepEqual(Less.resolve(path, [target]), [
'{BASE_URL}/octo/foo.less',
githubSearch({ path, target }).toString(),
{
path: '/octo/dog.less',
target: 'foo.less',
type: 'github-search',
},
]);
});
});
25 changes: 20 additions & 5 deletions packages/plugin-sass/__tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import assert from 'assert';
import githubSearch from '@octolinker/resolver-github-search';
import Sass from '../index';

describe('Sass', () => {
Expand All @@ -10,17 +9,33 @@ describe('Sass', () => {
assert.deepEqual(Sass.resolve(path, [target]), [
'{BASE_URL}/octo/_foo.scss',
'{BASE_URL}/octo/_foo.sass',
githubSearch({ path, target }).toString(),
githubSearch({ path, target }).toString(),
{
path: '/octo/dog.scss',
target: '_foo.scss',
type: 'github-search',
},
{
path: '/octo/dog.scss',
target: '_foo.sass',
type: 'github-search',
},
]);
});

it('resolves link when target has a file extension', () => {
assert.deepEqual(Sass.resolve(path, ['foo.scss']), [
'{BASE_URL}/octo/_foo.scss',
'{BASE_URL}/octo/_foo.sass',
githubSearch({ path, target }).toString(),
githubSearch({ path, target }).toString(),
{
path: '/octo/dog.scss',
target: '_foo.scss',
type: 'github-search',
},
{
path: '/octo/dog.scss',
target: '_foo.sass',
type: 'github-search',
},
]);
});
});
31 changes: 0 additions & 31 deletions packages/resolver-github-search/__tests__/index.js

This file was deleted.