This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe(`functionName()`, () => { | |
| afterEach(() => { | |
| //clean up after every `it` block | |
| }); | |
| describe(`When …. specify the external state you want to test against`, () => { | |
| beforeEach(() => { | |
| // setup the external state, ex: populate db, async storage etc | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { IonicPage } from 'ionic-angular'; | |
| import { SqlProvider } from '../path/to/sql-provider'; | |
| @IonicPage() | |
| @Component({ | |
| selector: 'page-home', | |
| templateUrl: 'home.html', | |
| }) | |
| export class HomePage { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const browserDBInstance = (db) => { | |
| return { | |
| executeSql: (sql) => { | |
| return new Promise((resolve, reject) => { | |
| db.transaction((tx) => { | |
| tx.executeSql(sql, [], (tx, rs) => { | |
| resolve(rs) | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { Injectable } from '@angular/core'; | |
| import { SQLite } from '@ionic-native/sqlite'; | |
| import { Platform } from 'ionic-angular'; | |
| import { isEmpty, isNull, keys, sortBy, get, parseInt } from 'lodash'; | |
| import { browserDBInstance } from './browser'; | |
| declare var window: any; | |
| const SQL_DB_NAME = process.env.IONIC_ENV === 'dev' ? '__broswer.db' : '__native.db'; | |
| @Injectable() |