• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

akvo / nmis-mobile / 5354048293

23 Jun 2023 07:45AM UTC coverage: 85.789% (+1.6%) from 84.173%
5354048293

Pull #18

github

web-flow
Merge c2e1cfd7c into b926bea24
Pull Request #18: Feature/15 setup database functions

49 of 62 branches covered (79.03%)

Branch coverage included in aggregate %.

42 of 42 new or added lines in 4 files covered. (100.0%)

114 of 128 relevant lines covered (89.06%)

16.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.42
/app/src/database/conn.js
1
import { Platform } from 'react-native';
2
import * as SQLite from 'expo-sqlite';
3

4
const openDatabase = () => {
2✔
5
  if (Platform.OS === 'web') {
2!
6
    return {
×
7
      transaction: () => {
8
        return {
×
9
          executeSql: () => {},
10
        };
11
      },
12
    };
13
  }
14
  const db = SQLite.openDatabase('db.db');
2✔
15
  return db;
2✔
16
};
17

18
const init = openDatabase();
2✔
19

20
const tx = (db, query, params = []) => {
2✔
21
  return new Promise((resolve, reject) => {
8✔
22
    db.transaction(
8✔
23
      (transaction) => {
24
        transaction.executeSql(
8✔
25
          query,
26
          params,
27
          (_, resultSet) => {
28
            resolve(resultSet);
8✔
29
          },
30
          (_, error) => {
31
            reject(error);
×
32
            return false; // Rollback the transaction
×
33
          },
34
        );
35
      },
36
      (error) => {
37
        reject(error);
×
38
      },
39
    );
40
  });
41
};
42

43
export const conn = {
2✔
44
  init,
45
  tx,
46
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc