How to use fake-indexeddb - 10 common examples

To help you get started, we’ve selected a few fake-indexeddb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github WorldBrain / Memex / src / search / __mocks__ / storex.ts View on Github external
}) as any

// Extend storex instance with Memex-specific methods
const instance = new Storex({ backend }) as StorageManager
const oldMethod = instance.collection.bind(instance)
instance.collection = (name: string) => ({
    ...oldMethod(name),
    suggestObjects: (query, opts) =>
        suggestObjects(new Promise(res => res(backend.dexieInstance as Dexie)))(
            name,
            query,
            opts,
        ),
})

instance.deleteDB = indexedDB.deleteDatabase

export default instance
github popeindustries / sw-test-env / lib / createContext.js View on Github external
module.exports = function createContext(globalScope, contextlocation, contextpath, origin, fetch) {
  const scriptModule = { exports: {} };
  const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
github popeindustries / sw-test-env / lib / createContext.js View on Github external
module.exports = function createContext(globalScope, contextlocation, contextpath, origin, fetch) {
  const scriptModule = { exports: {} };
  const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
github popeindustries / sw-test-env / lib / createContext.js View on Github external
module.exports = function createContext(globalScope, contextlocation, contextpath, origin, fetch) {
  const scriptModule = { exports: {} };
  const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
github popeindustries / sw-test-env / lib / createContext.js View on Github external
module.exports = function createContext(globalScope, contextlocation, contextpath, origin, fetch) {
  const scriptModule = { exports: {} };
  const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
      userAgent: 'sw-test-env'
github popeindustries / sw-test-env / lib / createContext.js View on Github external
module.exports = function createContext(globalScope, contextlocation, contextpath, origin, fetch) {
  const scriptModule = { exports: {} };
  const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
      userAgent: 'sw-test-env'
    },
github popeindustries / sw-test-env / lib / createContext.js View on Github external
const scriptModule = { exports: {} };
  const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
      userAgent: 'sw-test-env'
    },
    Notification,
github popeindustries / sw-test-env / lib / createContext.js View on Github external
const context = Object.assign(globalScope, {
    Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
      userAgent: 'sw-test-env'
    },
    Notification,
    NotificationEvent,
github popeindustries / sw-test-env / lib / createContext.js View on Github external
Cache,
    CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
      userAgent: 'sw-test-env'
    },
    Notification,
    NotificationEvent,
    PushEvent,
github popeindustries / sw-test-env / lib / createContext.js View on Github external
CacheStorage,
    Client,
    Clients,
    ExtendableEvent,
    FetchEvent,
    FormData,
    Headers,
    IDBCursor: FDBCursor.default,
    IDBCursorWithValue: FDBCursorWithValue.default,
    IDBDatabase: FDBDatabase.default,
    IDBFactory: FDBFactory.default,
    IDBIndex: FDBIndex.default,
    IDBKeyRange: FDBKeyRange.default,
    IDBObjectStore: FDBObjectStore.default,
    IDBOpenDBRequest: FDBOpenDBRequest.default,
    IDBRequest: FDBRequest.default,
    IDBTransaction: FDBTransaction.default,
    IDBVersionChangeEvent: FDBVersionChangeEvent.default,
    MessageChannel,
    MessageEvent,
    MessagePort,
    navigator: {
      connection: 'not implemented',
      online: true,
      permissions: 'not implemented',
      storage: 'not implemented',
      userAgent: 'sw-test-env'
    },
    Notification,
    NotificationEvent,
    PushEvent,
    PushManager,