本文整理汇总了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');
});
示例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);
});
示例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,