本文整理匯總了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;
});