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


TypeScript assert.called方法代碼示例

本文整理匯總了TypeScript中Sinon.assert.called方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript assert.called方法的具體用法?TypeScript assert.called怎麽用?TypeScript assert.called使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sinon.assert的用法示例。


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

示例1: test

test("test watch", () => {
  const am = genAM();
  const spy1 = sinon.spy();
  const spy2 = sinon.spy();
  am.addAttribute(genAttr(NSIdentity.fromFQN("hoge.aaa"), () => {
    spy1("watch");
  }));
  am.addAttribute(genAttr(NSIdentity.fromFQN("hoge.aaa"), () => {
    spy2("watch");
  }));
  am.watch(NSIdentity.guess("hoge.aaa"), (a, b, c) => { /*do nothing*/ });
  sinon.assert.called(spy1);
  sinon.assert.called(spy2);
});
開發者ID:emadurandal,項目名稱:GrimoireJS,代碼行數:14,代碼來源:AttributeManagerTest.ts

示例2: test

    test('calls indices.delete', async () => {
      const callCluster = sinon.spy(async (path: string, { index }: any) => {
        expect(path).toEqual('indices.delete');
        expect(index).toEqual('.lotr');
      });

      await Index.deleteIndex(callCluster, '.lotr');
      sinon.assert.called(callCluster);
    });
開發者ID:liuyepiaoxiang,項目名稱:kibana,代碼行數:9,代碼來源:elastic_index.test.ts

示例3: test

    test('calls indices.create', async () => {
      const callCluster = sinon.spy(async (path: string, { body, index }: any) => {
        expect(path).toEqual('indices.create');
        expect(body).toEqual({ mappings: { foo: 'bar' } });
        expect(index).toEqual('.abcd');
      });

      await Index.createIndex(callCluster, '.abcd', { foo: 'bar' } as any);
      sinon.assert.called(callCluster);
    });
開發者ID:salihkardan,項目名稱:kibana,代碼行數:10,代碼來源:elastic_index.test.ts

示例4: test

test("Broadcast message with range should work correctly", (t) => {
  const testNode3 = rootNode.children[0];
  resetSpies();
  testNode3.enabled = true;
  rootNode.broadcastMessage(1, "onTest");
  sinon.assert.called(testComponent3Spy);
  sinon.assert.notCalled(testComponent2Spy);
  sinon.assert.notCalled(testComponentOptionalSpy);
  sinon.assert.notCalled(testComponent1Spy);
});
開發者ID:emadurandal,項目名稱:GrimoireJS,代碼行數:10,代碼來源:GomlNode2Test.ts

示例5: test

    test('it calls indices.putMapping', async () => {
      const callCluster = sinon.spy(async (path: string, { body, type, index }: any) => {
        expect(path).toEqual('indices.putMapping');
        expect(index).toEqual('.shazm');
        expect(body).toEqual({
          dynamic: 'strict',
          properties: {
            foo: 'bar',
          },
        });
      });

      await Index.putMappings(callCluster, '.shazm', {
        dynamic: 'strict',
        properties: {
          foo: 'bar',
        },
      });

      sinon.assert.called(callCluster);
    });
開發者ID:lucabelluccini,項目名稱:kibana,代碼行數:21,代碼來源:elastic_index.test.ts

示例6: it

 it("enableCircularCheck option is true", () => {
     const result = plainToClass<User, Object>(User, user, { enableCircularCheck: true }); 
     sinon.assert.called(isCircularSpy);
 });
開發者ID:MagnusCloudCorp,項目名稱:class-transformer,代碼行數:4,代碼來源:circular-reference-problem.spec.ts

示例7: setTimeout

 setTimeout(() => {
   sinon.assert.called(postStub);
 }, ReportingLoopIntervalInMs + 100);
開發者ID:drvegass,項目名稱:telemetry,代碼行數:3,代碼來源:index.spec.ts


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