本文整理汇总了TypeScript中emberclear/tests/helpers.getStore函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getStore函数的具体用法?TypeScript getStore怎么用?TypeScript getStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getStore函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: test
test('a new user is created and stored', async function(assert) {
const before = await getStore().findAll('user');
assert.equal(before.length, 0);
await createCurrentUser();
const after = await getStore().findAll('user');
assert.equal(after.length, 1);
assert.equal(after.toArray()[0].id, 'me');
});
示例2: test
test('the message is saved', async function(assert) {
const store = getStore();
const service = getService<ReceivedMessageHandler>('messages/handler');
const me = getService<CurrentUserService>('currentUser');
const sender = await attributesForContact();
const before = await store.findAll('message');
const beforeCount = before.toArray().length;
await service.handle({
id: uuid(),
type: TYPE.CHAT,
target: TARGET.WHISPER,
to: me.record!.uid,
['time_sent']: new Date(),
client: 'tests',
['client_version']: '0',
sender: {
uid: sender.id,
name: `user with id: ${sender.id}`,
location: '',
},
message: {
body: 'malformed, cleartext body',
contentType: 'is this used?',
},
});
const after = await store.findAll('message');
assert.equal(after.length, beforeCount + 1);
});
示例3: test
test('sets the "me" identity', function(assert) {
const store = getStore();
const known = store.peekAll('user');
assert.equal(known.length, 1);
assert.equal(known.toArray()[0].id, 'me');
});
示例4: function
hooks.beforeEach(async function(assert) {
const store = getStore();
await store.createRecord('message', {}).save();
await store.createRecord('message', {}).save();
const messages = await store.findAll('message');
assert.equal(messages.length, 2);
});
示例5: test
test('there are 0 channels', async function(assert) {
const store = getStore();
const known = await store.findAll('channel');
assert.equal(known.length, 0);
});