我想计算包括风险在内的价格。问题是我想避免循环引用。有什么方法可以避免启用“迭代计算”?
基本上我需要在B9中计算价格,它是import { TestBed, ComponentFixture, async } from '@angular/core/testing';
import { ProcessoService } from './processo.service';
import { PontuaAppConfig } from 'frontend-base';
import { AbstractCRUDService, BlockUiService, UtilsService } from 'serpro-web-base';
import { HttpClient } from '@angular/common/http';
import { ProcessoModule } from './processo.module';
class PontuaAppConfigStub {
baseApiUrl = '';
}
describe('Serviço Processo', () => {
let sut: ProcessoService;
let pontuaAppConfig: PontuaAppConfig;
let fixture: ComponentFixture<ProcessoService>;
beforeEach(done => (async () => {
TestBed.configureTestingModule({
providers: [
{ provide: HttpClient, useClass: HttpClient, deps: [] },
{ provide: PontuaAppConfig, useClass: PontuaAppConfigStub },
{ provide: AbstractCRUDService, useClass: ProcessoService },
ProcessoService,
BlockUiService,
UtilsService,
],
imports: [ProcessoModule],
declarations: []
});
pontuaAppConfig = TestBed.get(PontuaAppConfig);
fixture = TestBed.createComponent(ProcessoService);
sut = fixture.debugElement.injector.get(ProcessoService);
await TestBed.compileComponents();
})().then(done).catch(done.fail));
it('should be created', () => {
console.log(sut);
expect(sut).toBeTruthy();
});
it('should Get apiUrl', () => {
spyOn(pontuaAppConfig, 'baseApiUrl');
sut.getApiUrl();
expect(pontuaAppConfig.baseApiUrl).toMatch('');
});
it('should set local store for processos', () => {
spyOn(sut, 'listarCache').and.returnValue({subscribe: () => {}});
fixture.detectChanges();
expect(sut.listarCache()).toHaveBeenCalled();
expect(window.localStorage.getItem('processos')).not.toBeNull();
});
});
其中B4为=(B1+B4)/(1-B7)
启用了迭代计算的结果”: