Browse Source

Naming standards

pull/8/head
Tim Glasgow 2 years ago
parent
commit
766729d5d3
  1. 0
      squarenotsquare/SquareNotSquare.js
  2. 12
      squarenotsquare/__tests__/DB-test.js
  3. 8
      squarenotsquare/index.js
  4. 4
      squarenotsquare/src/navigation/SquareNav.js
  5. 4
      squarenotsquare/src/navigation/SquareStack.js
  6. 8
      squarenotsquare/src/realm/DbAPI.js
  7. 0
      squarenotsquare/src/realm/DbInit.js
  8. 4
      squarenotsquare/src/redux/CreateStore.js
  9. 6
      squarenotsquare/src/redux/actions/SystemActions.js

0
squarenotsquare/Launcher.js → squarenotsquare/SquareNotSquare.js

12
squarenotsquare/__tests__/DB-test.js

@ -1,5 +1,5 @@
import { initDB } from '../src/realm/dbInit';
import dbAPI from '../src/realm/dbAPI';
import { initDB } from '../src/realm/DbInit';
import DbAPI from '../src/realm/DbAPI';
test('Realm DB inits', () => {
return initDB('negTest', 'negTest')
@ -32,7 +32,7 @@ test('Realm DB returns null after exceptions', () => {
test('dbAPI calls system repo getAllSystemValues()', () => {
return initDB('isNull', 'isNull')
.then( () => {
let returned = dbAPI.getAllSystemValues();
let returned = DbAPI.getAllSystemValues();
expect(returned).toEqual({});
});
});
@ -40,7 +40,7 @@ test('dbAPI calls system repo getAllSystemValues()', () => {
test('dbAPI calls system repo createSystemValue()', () => {
return initDB('isNull', 'isNull')
.then( () => {
let returned = dbAPI.createSystemValue();
let returned = DbAPI.createSystemValue();
expect(returned).toEqual(true);
});
});
@ -48,7 +48,7 @@ test('dbAPI calls system repo createSystemValue()', () => {
test('dbAPI calls system repo deleteSystemValue()', () => {
return initDB('isNull', 'isNull')
.then( () => {
let returned = dbAPI.deleteSystemValue();
let returned = DbAPI.deleteSystemValue();
expect(returned).toEqual(true);
});
});
@ -56,7 +56,7 @@ test('dbAPI calls system repo deleteSystemValue()', () => {
test('dbAPI calls system repo getSystemValue()', () => {
return initDB('isNull', 'isNull')
.then( () => {
let returned = dbAPI.getSystemValue('notakey');
let returned = DbAPI.getSystemValue('notakey');
expect(returned.id).toEqual(null);
});
});

8
squarenotsquare/index.js

@ -1,12 +1,12 @@
import React from 'react';
import {AppRegistry} from 'react-native';
import {name as appName} from './app.json';
import SquareNotSquare from './Launcher';
import configStore from './src/redux/CreateStore';
import SquareNotSquare from './SquareNotSquare';
import ConfigStore from './src/redux/CreateStore';
import { appInit } from './src/redux/actions/SystemActions';
const squareStore = configStore;
squareStore.dispatch(appInit());
const ConfigStore = configStore;
ConfigStore.dispatch(appInit());
const ProppedContainer = () => {
return <SquareNotSquare {...{squareStore: squareStore}} />;

4
squarenotsquare/src/navigation/SquareNav.js

@ -1,8 +1,8 @@
import { createRef } from "react";
export const squareRef = createRef();
export const SquareRef = createRef();
export function navigate(name, params) {
squareRef.current?.navigate(name, params);
SquareRef.current?.navigate(name, params);
return true;
}

4
squarenotsquare/src/navigation/SquareStack.js

@ -1,7 +1,7 @@
import React from 'react';
import {NavigationContainer} from '@react-navigation/native';
import {createStackNavigator} from '@react-navigation/stack';
import {squareRef} from './SquareNav';
import {SquareRef} from './SquareNav';
import Home from '../screens/Home';
import Game from '../screens/Game';
@ -15,7 +15,7 @@ function SquareStack() {
let noHeader = {headerShown: false};
return (
<NavigationContainer ref={squareRef}>
<NavigationContainer ref={SquareRef}>
<SquareNav.Navigator initialRouteName="Splash">
<SquareNav.Screen
name="Splash"

8
squarenotsquare/src/realm/dbAPI.js → squarenotsquare/src/realm/DbAPI.js

@ -1,6 +1,6 @@
import {initDB} from './dbInit';
import {initDB} from './DbInit';
class DbAPI {
class DatabaseAPI {
constructor(){
this.systemRepo = null;
this.scoreRepo = null;
@ -33,5 +33,5 @@ class DbAPI {
}
}
const dbAPI = new DbAPI();
export default dbAPI;
const DbAPI = new DatabaseAPI();
export default DbAPI;

0
squarenotsquare/src/realm/dbInit.js → squarenotsquare/src/realm/DbInit.js

4
squarenotsquare/src/redux/CreateStore.js

@ -1,8 +1,8 @@
import { configureStore } from '@reduxjs/toolkit';
import rootReducer from './reducers/RootReducer';
const configStore = configureStore({
const ConfigStore = configureStore({
reducer: rootReducer
});
export default configStore;
export default ConfigStore;

6
squarenotsquare/src/redux/actions/SystemActions.js

@ -1,10 +1,10 @@
import { initDB } from "../../realm/dbInit";
import dbAPI from "../../realm/dbAPI";
import { initDB } from "../../realm/DbInit";
import DbAPI from "../../realm/DbAPI";
import { APP_INIT } from "../types/SystemTypes";
export function appInit() {
return async (dispatch) => {
await dbAPI.initDB();
await DbAPI.initDB();
dispatch(onInit());
}
}

Loading…
Cancel
Save