Update web-platform-tests to revision 8a14626934f5748a4ea6210847a02c0d8bbc8560

This commit is contained in:
WPT Sync Bot 2019-03-07 20:52:27 -05:00
parent defc176333
commit 4851e4e2b9
133 changed files with 3076 additions and 304 deletions

View file

@ -1,4 +1,9 @@
'use strict';
// Imported from:
// https://github.com/WICG/import-maps/blob/master/reference-implementation/__tests__/resolving.js
// TODO: Upstream local changes.
const { URL } = require('url');
const { parseFromString } = require('../lib/parser.js');
const { resolve } = require('../lib/resolver.js');
@ -203,4 +208,23 @@ describe('Mapped using the "imports" key only (no scopes)', () => {
expect(resolveUnderTest('/test')).toMatchURL('https://example.com/lib/test2.mjs');
});
});
describe('overlapping entries with trailing slashes', () => {
const resolveUnderTest = makeResolveUnderTest(`{
"imports": {
"a": "/1",
"a/": "/2/",
"a/b": "/3",
"a/b/": "/4/"
}
}`);
it('most-specific wins', () => {
expect(resolveUnderTest('a')).toMatchURL('https://example.com/1');
expect(resolveUnderTest('a/')).toMatchURL('https://example.com/2/');
expect(resolveUnderTest('a/b')).toMatchURL('https://example.com/3');
expect(resolveUnderTest('a/b/')).toMatchURL('https://example.com/4/');
expect(resolveUnderTest('a/b/c')).toMatchURL('https://example.com/4/c');
});
});
});