• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript health.component.JhiHealthCheckComponent类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中app/admin/health/health.component.JhiHealthCheckComponent的典型用法代码示例。如果您正苦于以下问题:TypeScript component.JhiHealthCheckComponent类的具体用法?TypeScript component.JhiHealthCheckComponent怎么用?TypeScript component.JhiHealthCheckComponent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了component.JhiHealthCheckComponent类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: describe

  describe('JhiHealthCheckComponent', () => {
    let comp: JhiHealthCheckComponent;
    let fixture: ComponentFixture<JhiHealthCheckComponent>;
    let service: JhiHealthService;

    beforeEach(async(() => {
      TestBed.configureTestingModule({
        imports: [JhipsterSampleApplicationTestModule],
        declarations: [JhiHealthCheckComponent]
      })
        .overrideTemplate(JhiHealthCheckComponent, '')
        .compileComponents();
    }));

    beforeEach(() => {
      fixture = TestBed.createComponent(JhiHealthCheckComponent);
      comp = fixture.componentInstance;
      service = fixture.debugElement.injector.get(JhiHealthService);
    });

    describe('baseName and subSystemName', () => {
      it('should return the basename when it has no sub system', () => {
        expect(comp.baseName('base')).toBe('base');
      });

      it('should return the basename when it has sub systems', () => {
        expect(comp.baseName('base.subsystem.system')).toBe('base');
      });

      it('should return the sub system name', () => {
        expect(comp.subSystemName('subsystem')).toBe('');
      });

      it('should return the subsystem when it has multiple keys', () => {
        expect(comp.subSystemName('subsystem.subsystem.system')).toBe(' - subsystem.system');
      });
    });

    describe('transformHealthData', () => {
      it('should flatten empty health data', () => {
        const data = {};
        const expected = [];
        expect(service.transformHealthData(data)).toEqual(expected);
      });

      it('should flatten health data with no subsystems', () => {
        const data = {
          details: {
            status: 'UP',
            db: {
              status: 'UP',
              database: 'H2',
              hello: '1'
            },
            mail: {
              status: 'UP',
              error: 'mail.a.b.c'
            }
          }
        };
        const expected = [
          {
            name: 'db',
            status: 'UP',
            details: {
              database: 'H2',
              hello: '1'
            }
          },
          {
            name: 'mail',
            error: 'mail.a.b.c',
            status: 'UP'
          }
        ];
        expect(service.transformHealthData(data)).toEqual(expected);
      });

      it('should flatten health data with subsystems at level 1, main system has no additional information', () => {
        const data = {
          details: {
            status: 'UP',
            db: {
              status: 'UP',
              database: 'H2',
              hello: '1'
            },
            mail: {
              status: 'UP',
              error: 'mail.a.b.c'
            },
            system: {
              status: 'DOWN',
              subsystem1: {
                status: 'UP',
                property1: 'system.subsystem1.property1'
              },
              subsystem2: {
                status: 'DOWN',
                error: 'system.subsystem1.error',
//.........这里部分代码省略.........
开发者ID:jhipster,项目名称:jhipster-sample-app,代码行数:101,代码来源:health.component.spec.ts


示例2: describe

    describe('JhiHealthCheckComponent', () => {
        let comp: JhiHealthCheckComponent;
        let fixture: ComponentFixture<JhiHealthCheckComponent>;
        let service: JhiHealthService;

        beforeEach(async(() => {
            TestBed.configureTestingModule({
                imports: [BackendJhipsterTestModule],
                declarations: [JhiHealthCheckComponent]
            })
                .overrideTemplate(JhiHealthCheckComponent, '')
                .compileComponents();
        }));

        beforeEach(() => {
            fixture = TestBed.createComponent(JhiHealthCheckComponent);
            comp = fixture.componentInstance;
            service = fixture.debugElement.injector.get(JhiHealthService);
        });

        describe('baseName and subSystemName', () => {
            it('should return the basename when it has no sub system', () => {
                expect(comp.baseName('base')).toBe('base');
            });

            it('should return the basename when it has sub systems', () => {
                expect(comp.baseName('base.subsystem.system')).toBe('base');
            });

            it('should return the sub system name', () => {
                expect(comp.subSystemName('subsystem')).toBe('');
            });

            it('should return the subsystem when it has multiple keys', () => {
                expect(comp.subSystemName('subsystem.subsystem.system')).toBe(' - subsystem.system');
            });
        });

        describe('transformHealthData', () => {
            it('should flatten empty health data', () => {
                const data = {};
                const expected = [];
                expect(service.transformHealthData(data)).toEqual(expected);
            });
        });

        it('should flatten health data with no subsystems', () => {
            const data = {
                details: {
                    status: 'UP',
                    db: {
                        status: 'UP',
                        database: 'H2',
                        hello: '1'
                    },
                    mail: {
                        status: 'UP',
                        error: 'mail.a.b.c'
                    }
                }
            };
            const expected = [
                {
                    name: 'db',
                    status: 'UP',
                    details: {
                        database: 'H2',
                        hello: '1'
                    }
                },
                {
                    name: 'mail',
                    error: 'mail.a.b.c',
                    status: 'UP'
                }
            ];
            expect(service.transformHealthData(data)).toEqual(expected);
        });

        it('should flatten health data with subsystems at level 1, main system has no additional information', () => {
            const data = {
                details: {
                    status: 'UP',
                    db: {
                        status: 'UP',
                        database: 'H2',
                        hello: '1'
                    },
                    mail: {
                        status: 'UP',
                        error: 'mail.a.b.c'
                    },
                    system: {
                        status: 'DOWN',
                        subsystem1: {
                            status: 'UP',
                            property1: 'system.subsystem1.property1'
                        },
                        subsystem2: {
                            status: 'DOWN',
//.........这里部分代码省略.........
开发者ID:ntquang22298,项目名称:backendJhipster,代码行数:101,代码来源:health.component.spec.ts


示例3: it

      it('should handle a 503 on refreshing health data', () => {
        // GIVEN
        spyOn(service, 'checkHealth').and.returnValue(throwError(new HttpErrorResponse({ status: 503, error: 'Mail down' })));
        spyOn(service, 'transformHealthData').and.returnValue(of({ health: 'down' }));

        // WHEN
        comp.refresh();

        // THEN
        expect(service.checkHealth).toHaveBeenCalled();
        expect(service.transformHealthData).toHaveBeenCalled();
        expect(comp.healthData.value).toEqual({ health: 'down' });
      });
开发者ID:jhipster,项目名称:jhipster-sample-app,代码行数:13,代码来源:health.component.spec.ts



注:本文中的app/admin/health/health.component.JhiHealthCheckComponent类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap