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


TypeScript ember-qunit.setupTest函数代码示例

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


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

示例1: module

module('Unit | Service | identity', function(hooks) {
  setupTest(hooks);

  skip('can dump and reload', async function(assert) {
    assert.expect(0);
  });
});
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:7,代码来源:service-unit-test.ts

示例2: module

module('Unit | Route | chat', function(hooks) {
  setupTest(hooks);

  test('it exists', function(assert) {
    let route = this.owner.lookup('route:chat');
    assert.ok(route);
  });
});
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:8,代码来源:route-unit-test.ts

示例3: module

module('Unit | Service | redirect-manager', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let service = this.owner.lookup('service:redirect-manager');
    assert.ok(service);
  });
});
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:9,代码来源:unit-test.ts

示例4: module

module('Unit | Controller | datasets/dataset/compliance', function(hooks): void {
  setupTest(hooks);

  test('it exists', function(assert): void {
    let controller = this.owner.lookup('controller:datasets/dataset/compliance');
    assert.ok(controller);
    assert.ok(typeof controller.fieldFilter === 'undefined', 'fieldFilter queryParam binding is undefined');
  });
});
开发者ID:alyiwang,项目名称:WhereHows,代码行数:9,代码来源:compliance-test.ts

示例5: module

module('Unit | Model | user', function(hooks) {
  setupTest(hooks);

  // Replace this with your real tests.
  test('it exists', function(assert) {
    let store = this.owner.lookup('service:store');
    let model = store.createRecord('user', {});
    assert.ok(model);
  });
});
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:10,代码来源:model-test.ts

示例6: module

module('Unit | Service | messages/auto-responder', function(hooks) {
  setupTest(hooks);
  setupCurrentUser(hooks);
  clearLocalStorage(hooks);

  test('it exists', function(assert) {
    let service = getService<AutoResponder>('messages/auto-responder');
    assert.ok(service);
  });

  module('cameOnline', function() {
    module('handling messages queued for resend', function() {
      module('there are no pending messages', function(hooks) {
        hooks.beforeEach(async function(assert) {
          const store = getService<StoreService>('store');
          const messages = await store.findAll('message');

          assert.equal(messages.length, 0, 'there are no messages');
        });

        test('no messages are sent', async function(assert) {
          assert.expect(1);

          const service = getService<AutoResponder>('messages/auto-responder');
          const somePerson = await createContact('some person');

          stubService('messages/dispatcher', {
            sendToUser: {
              perform(/* _response: Message, _to: Identity */) {
                assert.ok(false, 'this method should not get called');
              },
            },
          });

          service.cameOnline(somePerson);
        });
      });

      module('there are pending messages', function(hooks) {
        let somePerson: Identity;
        let service: AutoResponder;

        hooks.beforeEach(async function(assert) {
          service = getService<AutoResponder>('messages/auto-responder');
          somePerson = await createContact('some person');

          const store = getService<StoreService>('store');
          const me = getService<CurrentUserService>('currentUser');
          let messages = await store.findAll('message');

          assert.equal(messages.length, 0, 'there are no messages');

          await store
            .createRecord('message', {
              to: somePerson.uid,
              queueForResend: true,
              sender: me.record,
            })
            .save();
          await store
            .createRecord('message', {
              to: somePerson.uid,
              queueForResend: true,
              sender: me.record,
            })
            .save();

          messages = await store.findAll('message');
          assert.equal(messages.length, 2, 'there are 2 messages');

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

          assert.equal(pendingMessages.length, 2, 'there are 2 pending messages');
        });

        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;
//.........这里部分代码省略.........
开发者ID:NullVoxPopuli,项目名称:emberclear,代码行数:101,代码来源:unit-test.ts

示例7: module

module('engine foo component', function(hooks) {
    setupTest(hooks, {
        resolver: Ember.Resolver.create()
    });
});
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:5,代码来源:ember-qunit-tests.ts


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