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


TypeScript chance.word函数代码示例

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


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

示例1: async

const enroll = async (kibanaURL: string, token: string) => {
  const beatId = uuidv4();

  await request(
    {
      url: `${kibanaURL}/api/beats/agent/${beatId}`,
      method: 'POST',
      headers: {
        'kbn-xsrf': 'xxx',
        'kbn-beats-enrollment-token': token,
      },
      body: JSON.stringify({
        type: Math.random() >= 0.5 ? 'filebeat' : 'metricbeat',
        host_name: `${chance.word()}.local`,
        name: chance.word(),
        version: '6.7.0',
      }),
    },
    (error: any, response: any, body: any) => {
      const res = JSON.parse(body);
      if (res.message) {
        // tslint:disable-next-line
        console.log(res.message);
      }
    }
  );
};
开发者ID:njd5475,项目名称:kibana,代码行数:27,代码来源:fake_env.ts

示例2: getRandomColor

 [...Array(maxNumberOfTagsPerBeat)].map(() => {
   return libs.tags.upsertTag({
     name: chance.word(),
     color: getRandomColor(),
     hasConfigurationBlocksTypes: [] as string[],
   } as BeatTag);
 })
开发者ID:njd5475,项目名称:kibana,代码行数:7,代码来源:fake_env.ts

示例3: it

    it('should return errors for non-existent beats and tags', async () => {
      const nonExistentBeatId = chance.word();
      const nonExistentTag = chance.word();

      const apiResponse = await beatsLib.assignTagsToBeats(internalUser, [
        { beatId: nonExistentBeatId, tag: nonExistentTag },
      ]);

      expect(apiResponse.assignments).toEqual([
        {
          result: `Beat ${nonExistentBeatId} and tag ${nonExistentTag} not found`,
          status: 404,
        },
      ]);

      const beat = beatsDB.find(b => b.id === 'bar') as any;
      expect(beat).not.toHaveProperty('tags');
    });
开发者ID:salihkardan,项目名称:kibana,代码行数:18,代码来源:assign_tags.test.ts

示例4: beforeEach

    beforeEach(async () => {
      validEnrollmentToken = chance.word();
      beatId = chance.word();

      beatsDB = [];
      tagsDB = [];
      tokensDB = [
        {
          expires_on: moment()
            .add(4, 'hours')
            .toJSON(),
          token: validEnrollmentToken,
        },
      ];

      const version =
        chance.integer({ min: 1, max: 10 }) +
        '.' +
        chance.integer({ min: 1, max: 10 }) +
        '.' +
        chance.integer({ min: 1, max: 10 });

      beat = {
        host_name: 'foo.bar.com',
        type: 'filebeat',
        version,
      };

      const framework = new HapiBackendFrameworkAdapter(settings);

      tokensLib = new CMTokensDomain(new MemoryTokensAdapter(tokensDB), {
        framework,
      });

      const tagsLib = new CMTagsDomain(new MemoryTagsAdapter(tagsDB));

      beatsLib = new CMBeatsDomain(new MemoryBeatsAdapter(beatsDB), {
        tags: tagsLib,
        tokens: tokensLib,
        framework,
      });
    });
开发者ID:salihkardan,项目名称:kibana,代码行数:42,代码来源:enroll.test.ts

示例5: beforeEach

    beforeEach(async () => {
      beatId = chance.word();
      beat = {
        host_name: 'foo.bar.com',
        type: 'filebeat',
        version: '6.4.0',
      };
      beatsDB = [];
      tagsDB = [];
      tokensDB = [];

      getBeatsLib();
    });
开发者ID:salihkardan,项目名称:kibana,代码行数:13,代码来源:update.test.ts

示例6: it

    it('should reject an invalid enrollment token', async () => {
      const { token } = await tokensLib.getEnrollmentToken(chance.word());

      expect(token).toEqual(null);
    });
开发者ID:salihkardan,项目名称:kibana,代码行数:5,代码来源:enroll.test.ts


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