本文整理汇总了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',
});
});
示例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');
});
示例3: function
hooks.beforeEach(async function() {
stubService('currentUser', {
isLoggedIn: false,
load() {},
exists: () => false,
});
await visit('/logout');
});
示例4: stubService
hooks.beforeEach(function() {
stubService('relay-manager', {
getOpenGraph: async (/* url: string */) => await respondWith,
});
});
示例5: function
hooks.beforeEach(async function() {
stubService('messages/auto-responder', {
messageReceived() {},
cameOnline() {},
});
});