Basic draft library #19

Merged
hamcha merged 13 commits from feature/draft-lib into master 2019-09-16 13:53:07 +00:00
3 changed files with 17 additions and 4 deletions
Showing only changes of commit cf47d5db4a - Show all commits

View file

@ -20,8 +20,10 @@ class CardDatabase extends Dexie {
export let Database: CardDatabase | null = null;
export function initDB() {
if (Database == null) {
Database = new CardDatabase();
}
}
export async function getCards(filter: CardFilter) {
if (Database == null) {

11
src/testing/IDBShim.ts Normal file
View file

@ -0,0 +1,11 @@
import Dexie from "dexie";
let init = false;
export function setupIDBShim() {
if (!init) {
const setGlobalVars = require("indexeddbshim");
setGlobalVars(Dexie.dependencies);
init = true;
}
}

View file

@ -1,7 +1,7 @@
import { loadSets, getCards, Database, initDB, cardFullName } from "@/mlpccg";
import Dexie from "dexie";
const setGlobalVars = require("indexeddbshim");
setGlobalVars(Dexie.dependencies);
import { setupIDBShim } from "@/testing/IDBShim";
setupIDBShim();
describe("mlpccg/Database", () => {
beforeAll(async () => {