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


TypeScript helpers.stubService函数代码示例

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


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

示例1: stubService

 hooks.beforeEach(function() {
   stubService('currentUser', {
     isLoggedIn: true,
   });
   stubService('router', {
     currentRouteName: 'chat',
   });
 });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:8,代码来源:service-unit-test.ts

示例2: test

        test('there are no longer any queued messages', async function(assert) {
          assert.expect(6);

          stubService('messages/dispatcher', {
            sendToUser: {
              perform(_response: Message, to: Identity) {
                assert.equal(to.uid, somePerson.uid, `message sent to: ${somePerson.name}`);
              },
            },
          });

          await service.cameOnline(somePerson);

          const store = getService<StoreService>('store');

          await waitUntilTruthy(async () => {
            let messages = await store.query('message', {
              queueForResend: true,
              to: somePerson.uid,
            });

            return messages.length === 0;
          });

          const messages = await store.query('message', {
            queueForResend: true,
            to: somePerson.uid,
          });

          assert.equal(messages.length, 0, 'there are no messages');
        });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:31,代码来源:unit-test.ts

示例3: function

    hooks.beforeEach(async function() {
      stubService('currentUser', {
        isLoggedIn: false,
        load() {},
        exists: () => false,
      });

      await visit('/logout');
    });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:9,代码来源:logout-test.ts

示例4: stubService

 hooks.beforeEach(function() {
   stubService('relay-manager', {
     getOpenGraph: async (/* url: string */) => await respondWith,
   });
 });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:5,代码来源:component-integration-test.ts

示例5: function

 hooks.beforeEach(async function() {
   stubService('messages/auto-responder', {
     messageReceived() {},
     cameOnline() {},
   });
 });
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:6,代码来源:unit-test.ts


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