本文整理汇总了TypeScript中src/wingbow/database/store._mockStore函数的典型用法代码示例。如果您正苦于以下问题:TypeScript _mockStore函数的具体用法?TypeScript _mockStore怎么用?TypeScript _mockStore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_mockStore函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: setRaw
storeNames.forEach(storeName => {
setRaw(storeKey, storeName, `aaa`, `AAA`);
expect(getRaw(storeKey, storeName, `aaa`)).toBe(`AAA`);
const store = new Map();
store.set(storeKey, {aaa: `MOCKED_AAA`});
_mockStore(storeName, store);
expect(getRaw(storeKey, storeName, `aaa`)).toBe(`MOCKED_AAA`);
});
示例2: it
it(`should exclude stored prototypal proterties`, () => {
const map = new Map();
_mockStore(`attributes`, map);
let that = null;
class MockModel extends UnprotectedModel {
constructor(attributes :JsonableObject) {
super(attributes);
that = this;
}
public fillable() { return [`q`, `r`, `s`]; }
}
const attributes = {q: 17, r: 18, s: 19};
const model = new MockModel(attributes);
expect(model.getAttributes()).toEqual({q: 17, r: 18, s: 19});
function Store() {
this.x = 24;
this.z = 26;
}
Store.prototype.y = 25;
const store = new Store();
map.set(that, store);
expect(model.getAttributes()).toEqual({x: 24, z: 26});
});
示例3: beforeEach
beforeEach(() => {
mockAttributesStore = new Map();
_mockStore(`attributes`, mockAttributesStore);
attributes = {a: 1, b: 2, c: 3};
model = new MockModel(attributes);
});
示例4: expect
expect(() => {
_mockStore(`STORE_NAME_NOT_DEFINED`, store);
}).toThrowError(IllegalStoreTypeError);
示例5: Map
storeNames.forEach(storeName => {
const store = new Map();
_mockStore(storeName, store);
localStores[storeName] = store;
});