/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
adev/src/app/editor/terminal/command-validator.service.spec.ts
35 строк
986 B
Kristiyan Kostadinov
test: remove unnecessary test calls
24 ноя 2025, 18:18
24 ноя 2025, 18:18
26e2092
Код
Авторство
О чём код?
/*! * @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 {TestBed} from '@angular/core/testing'; import {ALLOWED_COMMAND_PREFIXES, CommandValidator} from './command-validator.service'; describe('CommandValidator', () => { let service: CommandValidator; beforeEach(() => { service = TestBed.inject(CommandValidator); }); it('should be created', () => { expect(service).toBeTruthy(); }); it('should return true when user try to execute allowed commands', () => { for (const command of ALLOWED_COMMAND_PREFIXES) { const result = service.validate(`${command} other command params`); expect(result).toBeTrue(); } }); it('should return false when user try to execute illegal commands', () => { const result = service.validate(`npm install`); expect(result).toBeFalse(); }); });