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


TypeScript ts-mockito.anyString函數代碼示例

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


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

示例1: it

 it('returns a promise that resolves to targetId', async () => {
   when(mockedNativeCommandsSender.popToRoot(anyString(), anyString(), anything())).thenResolve(
     'theComponentId'
   );
   const result = await uut.popToRoot('theComponentId');
   expect(result).toEqual('theComponentId');
 });
開發者ID:wix,項目名稱:react-native-navigation,代碼行數:7,代碼來源:Commands.test.ts

示例2: beforeEach

  beforeEach(() => {
    const mockedAssetService = mock(AssetService);
    when(mockedAssetService.resolveFromRequire(anyNumber())).thenReturn({
      height: 100,
      scale: 1,
      uri: 'lol',
      width: 100
    });
    const assetService = instance(mockedAssetService);

    const mockedColorService = mock(ColorService);
    when(mockedColorService.toNativeColor(anyString())).thenReturn(666);
    const colorService = instance(mockedColorService);

    uut = new OptionsProcessor(store, new UniqueIdProvider(), colorService, assetService);
  });
開發者ID:wix,項目名稱:react-native-navigation,代碼行數:16,代碼來源:OptionsProcessor.test.ts

示例3: mock

// Mocking configuration
let outputTopic = 'output.1_0.HelloWorldMicroservice.HelloWorld.HelloWorldResponse';
let snapshotTopic = 'snapshot.1_0.HelloWorldMicroservice.HelloWorld';
let stateName = 'stateName';
let componentCode = -69981087;
let stateMachineCode = -829536631;

let apiConfiguration: ApiConfiguration = mock(DefaultApiConfiguration);

when(apiConfiguration.getSubscriberTopic(anyNumber(), anyNumber(), anything())).thenReturn(outputTopic);

when(apiConfiguration.getSnapshotTopic(anyNumber())).thenReturn('snapshot.1_0.HelloWorldMicroservice.HelloWorld');

when(apiConfiguration.getStateName(anyNumber(), anyNumber(), anyNumber())).thenReturn(stateName);

when(apiConfiguration.getComponentCode(anyString())).thenReturn(componentCode);

when(apiConfiguration.getStateMachineCode(anyString(), anyString())).thenReturn(stateMachineCode);

// Initilisation of expected data
let correctData = {
    Header: { IncomingEventType: 0 },
    JsonMessage: JSON.stringify({ Topic: { Key: outputTopic, kind: Kinds.Public } })
};

let stateMachineId = '2';
let jsonMessage: JsonMessage = { key: 'value' };
let jsonData = {
    Header: {
        StateMachineCode: stateMachineCode,
        ComponentCode: componentCode,
開發者ID:xcomponent,項目名稱:ReactiveXComponent.js,代碼行數:31,代碼來源:mockSubscriberDependencies.ts


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