-
Notifications
You must be signed in to change notification settings - Fork 12k
/
Copy pathdeploy-url_spec.ts
39 lines (34 loc) · 1.33 KB
/
deploy-url_spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import { Architect, BuilderRun } from '@angular-devkit/architect';
import { DevServerBuilderOutput } from '@angular-devkit/build-angular';
import fetch from 'node-fetch'; // tslint:disable-line:no-implicit-dependencies
import { createArchitect, host } from '../test-utils';
describe('Dev Server Deploy Url', () => {
const target = { project: 'app', target: 'serve' };
let architect: Architect;
let runs: BuilderRun[] = [];
beforeEach(async () => {
await host.initialize().toPromise();
architect = (await createArchitect(host.root())).architect;
runs = [];
});
afterEach(async () => {
await host.restore().toPromise();
await Promise.all(runs.map(r => r.stop()));
});
it('works', async () => {
const run = await architect.scheduleTarget(target, { deployUrl: 'test/' });
runs.push(run);
const output = await run.result as DevServerBuilderOutput;
expect(output.success).toBe(true);
expect(output.baseUrl).toBe('http://localhost:4200/test');
const response = await fetch(`${output.baseUrl}/polyfills.js`);
expect(await response.text()).toContain('window["webpackJsonp"]');
}, 30000);
});