/
githubmirror
/
angular
Обзор
Документация
Войти
/
githubmirror
/
angular
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
adev/src/app/editor/node-runtime-state.service.spec.ts
48 строк
1 KB
Matthieu Riegler
docs(docs-infra): lift circular imports (#63186)
19 авг 2025, 10:58
19 авг 2025, 10:58
9b539a1
Код
Авторство
О чём код?
/*! * @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 {ErrorType, NodeRuntimeState} from './node-runtime-state.service'; import {OUT_OF_MEMORY_MSG} from './node-runtime-errors'; describe('NodeRuntimeState', () => { let service: NodeRuntimeState; beforeEach(() => { TestBed.configureTestingModule({ providers: [NodeRuntimeState], }); service = TestBed.inject(NodeRuntimeState); }); it('should be created', () => { expect(service).toBeTruthy(); }); it('should set cookies error type based on error message', () => { service.setError({message: 'service worker', type: undefined}); expect(service['error']()!.type).toBe(ErrorType.COOKIES); }); it('should set out of memory error type based on error message', () => { service.setError({message: OUT_OF_MEMORY_MSG, type: undefined}); expect(service['error']()!.type).toBe(ErrorType.OUT_OF_MEMORY); }); it('should set unknown error type based on error message', () => { service.setError({message: 'something else', type: undefined}); expect(service['error']()!.type).toBe(ErrorType.UNKNOWN); }); it('should set unknown error type if error message is undefined', () => { service.setError({message: undefined, type: undefined}); expect(service['error']()!.type).toBe(ErrorType.UNKNOWN); }); });