當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript expect.js類代碼示例

本文整理匯總了TypeScript中expect.js的典型用法代碼示例。如果您正苦於以下問題:TypeScript js類的具體用法?TypeScript js怎麽用?TypeScript js使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了js類的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: it

    it('fill correct data - no errors', function () {

        //when
        this.Data.Contacts.push(getItemDataTemplate());
        this.Data.Contacts.push(getItemDataTemplate());
        this.Data.Contacts.push(getItemDataTemplate());

        //excercise
        var result = this.MainValidator.Validate(this.Data);
        //verify
        expect(result.HasErrors).to.equal(false);

    });
開發者ID:rsamec,項目名稱:business-rules-engine,代碼行數:13,代碼來源:formSchema.ts

示例2: async

  const createExpectSpaceAwareResults = (spaceId = DEFAULT_SPACE_ID) => async (resp: {
    [key: string]: any;
  }) => {
    expect(resp.body)
      .to.have.property('id')
      .match(/^[0-9a-f-]{36}$/);

    // loose ISO8601 UTC time with milliseconds validation
    expect(resp.body)
      .to.have.property('updated_at')
      .match(/^[\d-]{10}T[\d:\.]{12}Z$/);

    expect(resp.body).to.eql({
      id: resp.body.id,
      type: spaceAwareType,
      updated_at: resp.body.updated_at,
      version: 1,
      attributes: {
        title: 'My favorite vis',
      },
    });

    const expectedSpacePrefix = spaceId === DEFAULT_SPACE_ID ? '' : `${spaceId}:`;

    // query ES directory to ensure namespace was or wasn't specified
    const { _source } = await es.get({
      id: `${expectedSpacePrefix}${spaceAwareType}:${resp.body.id}`,
      type: 'doc',
      index: '.kibana',
    });

    const { namespace: actualNamespace } = _source;

    if (spaceId === DEFAULT_SPACE_ID) {
      expect(actualNamespace).to.eql(undefined);
    } else {
      expect(actualNamespace).to.eql(spaceId);
    }
  };
開發者ID:liuyepiaoxiang,項目名稱:kibana,代碼行數:39,代碼來源:create.ts

示例3: it

        it('fill incorrect data - some errors', function () {

            //when
            this.Data.Checked = true;
            this.Data.FirstName = "John Junior";
            this.Data.LastName = "Smith";

            //excercise
            var result = this.PersonValidator.Validate(this.Data);

            //verify
            expect(result.HasErrors).to.equal(true);
        });
開發者ID:rsamec,項目名稱:business-rules-engine,代碼行數:13,代碼來源:rules.ts

示例4: done

 jobs.jobs({ name: 'jobA', data: 'someData' }, (err, j) =>  {
     if (err) {
         return done(err);
     }
     expect(j).to.have.length(0);
     jobs.jobs({ name: 'jobA' }, (err, j) =>  {
         if (err) {
             return done(err);
         }
         expect(j).to.have.length(1);
         done();
     });
 });
開發者ID:cdbajorin,項目名稱:typed-agenda,代碼行數:13,代碼來源:agenda.ts

示例5: expect

 const createExpectNotSpaceAwareResults = (spaceId = DEFAULT_SPACE_ID) => (resp: {
   [key: string]: any;
 }) => {
   expect(resp.body).to.eql({
     id: `${notSpaceAwareId}`,
     type: 'globaltype',
     updated_at: '2017-09-21T18:59:16.270Z',
     version: resp.body.version,
     attributes: {
       name: 'My favorite global object',
     },
   });
 };
開發者ID:liuyepiaoxiang,項目名稱:kibana,代碼行數:13,代碼來源:get.ts

示例6: it

            it('fill two items', function () {
                //when
                data.Hobbies = [
                    {HobbyName: "Skiing"},
                    {HobbyName: 'Chess'}
                ]

                //exec
                var result = businessRules.Validate(data);

                //verify
                expect(result.Errors["Hobbies"].HasErrors).to.equal(false)
            });
開發者ID:rsamec,項目名稱:business-rules,代碼行數:13,代碼來源:hobbiesSchema.ts

示例7: it

 it('should set members by parameters', () => {
     expect(chrobject).to.be.ok();
     expect(chrobject.entity).to.be.ok();
     expect(chrobject.entity).to.eql(entity);
     expect(chrobject.config).to.eql(config);
     expect(chrobject.appService).to.be.ok();
     expect(chrobject.appService).to.eql(new EntryAppService(entity, storage, options));
 });
開發者ID:hydra-newmedia,項目名稱:chrobject,代碼行數:8,代碼來源:ChrobjectTest.ts

示例8: it

  it("add first party caveat 3 times", function () {

    // given
    var m = new MacaroonsBuilder(location, secret, identifier)
        .add_first_party_caveat("account = 3735928559")
        .add_first_party_caveat("time < 2015-01-01T00:00")
        .add_first_party_caveat("email = alice@example.org")
        .getMacaroon();

    expect(m.location).to.be(location);
    expect(m.identifier).to.be(identifier);
    expect(m.caveatPackets[0].type).to.be(CaveatPacketType.cid);
    expect(m.caveatPackets[0].getValueAsText()).to.be("account = 3735928559");
    expect(m.caveatPackets[1].type).to.be(CaveatPacketType.cid);
    expect(m.caveatPackets[1].getValueAsText()).to.be("time < 2015-01-01T00:00");
    expect(m.caveatPackets[2].type).to.be(CaveatPacketType.cid);
    expect(m.caveatPackets[2].getValueAsText()).to.be("email = alice@example.org");
    expect(m.signature).to.be("882e6d59496ed5245edb7ab5b8839ecd63e5d504e54839804f164070d8eed952");
  });
開發者ID:cmbankester,項目名稱:macaroons.js,代碼行數:19,代碼來源:MacaroonsBuilderCaveatsTest.ts

示例9: it

 it('should set entity and storage members', () => {
     eas = new EntryAppService(entity, storage, options);
     expect(eas instanceof EntryAppService).to.be.ok();
     expect(eas.entity).to.be.ok();
     expect(eas.entity).to.eql(entity);
     expect(eas.storage).to.be.ok();
     expect(eas.storage).to.eql(storage);
     expect(eas.options).to.be.ok();
     expect(eas.options).to.eql({
         ignoreProperties: ['data.ignored'], ignoreSubProperties: []
     });
 });
開發者ID:hydra-newmedia,項目名稱:chrobject,代碼行數:12,代碼來源:EntryAppServiceTest.ts


注:本文中的expect.js類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。