当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript health.service.JhiHealthService类代码示例

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


在下文中一共展示了service.JhiHealthService类的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 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);
 });
开发者ID:jhipster,项目名称:jhipster-sample-app,代码行数:32,代码来源:health.component.spec.ts


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