forked from angular/angular-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmock-host.ts
More file actions
25 lines (23 loc) · 1005 Bytes
/
mock-host.ts
File metadata and controls
25 lines (23 loc) · 1005 Bytes
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
/**
* @license
* Copyright Google LLC 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.dev/license
*/
import type { Host } from '../host';
/**
* A mock implementation of the `Host` interface for testing purposes.
* This class allows spying on host methods and controlling their return values.
*/
export class MockHost implements Host {
runCommand = jasmine.createSpy('runCommand').and.resolveTo({ logs: [] });
stat = jasmine.createSpy('stat');
existsSync = jasmine.createSpy('existsSync');
readFile = jasmine.createSpy('readFile').and.resolveTo('');
glob = jasmine.createSpy('glob').and.returnValue((async function* () {})());
resolveModule = jasmine.createSpy('resolveRequest').and.returnValue('/dev/null');
spawn = jasmine.createSpy('spawn');
getAvailablePort = jasmine.createSpy('getAvailablePort');
isPortAvailable = jasmine.createSpy('isPortAvailable').and.resolveTo(true);
}