Skip to content

Commit

Permalink
Emergency-copied some no-longer-published test files from analyzer in…
Browse files Browse the repository at this point in the history
…to bundler's test-utils.ts.
  • Loading branch information
usergenic committed Jan 10, 2019
1 parent d1130a2 commit d8b7e2c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/bundler/src/test/bundle-manifest_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as chai from 'chai';
import {ResolvedUrl} from 'polymer-analyzer';
import {resolvedUrl as r} from 'polymer-analyzer/lib/test/test-utils';

import {Bundle, BundleManifest, composeStrategies, generateBundles, generateCountingSharedBundleUrlMapper, generateEagerMergeStrategy, generateMatchMergeStrategy, generateSharedBundleUrlMapper, generateSharedDepsMergeStrategy, generateShellMergeStrategy, mergeBundles, mergeSingleEntrypointSubBundles, TransitiveDependenciesMap} from '../bundle-manifest';
import {resolvedUrl as r} from '../test/test-utils';

chai.config.showDiff = true;

Expand Down
13 changes: 12 additions & 1 deletion packages/bundler/src/test/test-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* subject to an additional IP rights grant found at
* http://polymer.github.io/PATENTS.txt
*/
import {Analyzer, InMemoryOverlayUrlLoader, PackageRelativeUrl, PackageUrlResolver} from 'polymer-analyzer';
import {Analyzer, InMemoryOverlayUrlLoader, PackageRelativeUrl, PackageUrlResolver, ResolvedUrl} from 'polymer-analyzer';

/**
* Automatically left-justifies an indented multi-line template literal string
Expand Down Expand Up @@ -88,6 +88,17 @@ export function mindent(text: string): number {
return mindent === null ? 0 : mindent;
}

export const noOpTag =
(strings: TemplateStringsArray, ...values: string[]): string =>
values.reduce(
(r: string, v: string, i) => r + String(v) + strings[i + 1],
strings[0]);

export function resolvedUrl(
strings: TemplateStringsArray, ...values: string[]): ResolvedUrl {
return noOpTag(strings, ...values) as ResolvedUrl;
}

/**
* Left-justifies text in a multi-line indented string, but preserves relative
* indentation; `undent(' a\n b')` returns `'a\n b'`.
Expand Down

0 comments on commit d8b7e2c

Please sign in to comment.