JHipster在构建时测试问题

我有一个JHIpster应用程序。现在我要生成一个罐子。我在生产中执行以下命令时遇到了这个问题

./mvnw -Pprod clean verify

开始测试时我收到此错误

[ERROR] FAIL src/test/javascript/spec/app/entities/cliente/cliente-update.component.spec.ts (109 MB heap size)
[ERROR]   â?? Component Tests â?º Cliente Management Update Component â?º save â?º Should call update service on save for existing entity
[ERROR]
[ERROR]     expect(spy).toHaveBeenCalledWith(expected)
[ERROR]

[ERROR]
[ERROR]     Difference:
[ERROR]
[ERROR]     - Expected
[ERROR]     + Received
[ERROR]
[ERROR]     - Cliente {
[ERROR]     + Object {
[ERROR]         "bairro": undefined,[ERROR]         "cancelado": false,[ERROR]         "cep": undefined
[ERROR]       }
[ERROR]
[ERROR]       41 |
[ERROR]       42 |         // THEN
[ERROR]     > 43 |         expect(service.update).toHaveBeenCalledWith(entity);
[ERROR]          |                                ^
[ERROR]       44 |         expect(comp.isUpdate).toEqual(false);
[ERROR]       45 |       }));
[ERROR]       46 |
[ERROR]
[ERROR]       at testing_1.fakeAsync (src/test/javascript/spec/app/entities/cliente/cliente-update.component.spec.ts:43:32)
[ERROR]       at node_modules/zone.js/dist/fake-async-test.js:793:22
[ERROR]       at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:440:160)
[ERROR]       at ProxyZonespec.onInvoke (node_modules/zone.js/dist/proxy.js:151:35)
[ERROR]       at ZoneDelegate.invoke (node_modules/zone.js/dist/zone.js:440:48)
[ERROR]       at Zone.run (node_modules/zone.js/dist/zone.js:167:37)
[ERROR]       at Object.testBody.length (node_modules/jest-preset-angular/zone-patch/index.js:51:54)

它期望cliente-update.component.spec.ts中有一个Cliente,但我使用的是Cliente实例而不是Object实例

describe('save',() => {
      it('Should call update service on save for existing entity',fakeAsync(() => {
        // GIVEN
        const entity = new Cliente(123);
        spyOn(service,'update').and.returnValue(of(new HttpResponse({ body: entity })));
        comp.updateForm(entity);
        // WHEN
        comp.save();
        tick(); // simulate async

        // THEN
        expect(service.update).toHaveBeenCalledWith(entity);
        expect(comp.isUpdate).toEqual(false);
      }));

      it('Should call create service on save for new entity',fakeAsync(() => {
        // GIVEN
        const entity = new Cliente();
        spyOn(service,'create').and.returnValue(of(new HttpResponse({ body: entity })));
        comp.updateForm(entity);
        // WHEN
        comp.save();
        tick(); // simulate async

        // THEN
        expect(service.create).toHaveBeenCalledWith(entity);
        expect(comp.isUpdate).toEqual(false);

执行./mvnw -Pprod时正常工作。如何解决?

sourcein 回答:JHipster在构建时测试问题

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3123460.html

大家都在问