From 23b27ebbdc1d5375b192ceeff6e18a4aea5d10c2 Mon Sep 17 00:00:00 2001 From: Tim Glasgow Date: Thu, 28 Jul 2022 22:32:13 -0500 Subject: [PATCH] move files to src folder --- squarenotsquare/Launcher.js | 2 +- squarenotsquare/__mock__/mockDB.js | 3 +++ squarenotsquare/__mock__/mockRealmObject.js | 6 +++--- squarenotsquare/__tests__/App-test.js | 12 ++++++------ squarenotsquare/__tests__/Migration-test.js | 6 +++--- squarenotsquare/__tests__/Redux-test.js | 16 ++++++++++++++++ squarenotsquare/index.js | 4 ++-- squarenotsquare/jest.config.js | 12 +++++------- squarenotsquare/{ => src}/libs/Random.js | 0 .../{ => src}/navigation/SquareNav.js | 0 .../{ => src}/navigation/SquareStack.js | 0 squarenotsquare/{ => src}/realm/dbAPI.js | 0 squarenotsquare/{ => src}/realm/dbInit.js | 0 .../{ => src}/realm/entities/Score.js | 0 .../{ => src}/realm/entities/System.js | 0 squarenotsquare/{ => src}/realm/entities/User.js | 0 .../{ => src}/realm/migrations/MigrateV0.js | 0 .../{ => src}/realm/migrations/MigrateV1.js | 0 .../{ => src}/realm/repos/ScoreRepo.js | 0 .../{ => src}/realm/repos/SystemRepo.js | 0 .../{ => src}/realm/repos/UserRepo.js | 0 squarenotsquare/{ => src}/redux/CreateStore.js | 0 .../{ => src}/redux/actions/SystemActions.js | 0 .../{ => src}/redux/actions/UserActions.js | 0 .../{ => src}/redux/reducers/NavReducer.js | 0 .../{ => src}/redux/reducers/RootReducer.js | 0 .../{ => src}/redux/reducers/SystemReducer.js | 0 .../{ => src}/redux/reducers/UserReducer.js | 0 .../{ => src}/redux/types/SystemTypes.js | 0 squarenotsquare/{ => src}/screens/Game.js | 0 squarenotsquare/{ => src}/screens/HighScore.js | 0 squarenotsquare/{ => src}/screens/Home.js | 0 squarenotsquare/{ => src}/screens/Settings.js | 0 squarenotsquare/{ => src}/screens/Splash.js | 0 .../{ => src}/screens/styles/AppStyles.js | 0 squarenotsquare/{ => src}/services/Keystore.js | 0 squarenotsquare/{ => src}/themes/Colors.js | 0 squarenotsquare/{ => src}/themes/Fonts.js | 0 squarenotsquare/{ => src}/themes/Icons.js | 0 squarenotsquare/{ => src}/themes/Metrics.js | 0 40 files changed, 39 insertions(+), 22 deletions(-) create mode 100644 squarenotsquare/__mock__/mockDB.js rename squarenotsquare/{ => src}/libs/Random.js (100%) rename squarenotsquare/{ => src}/navigation/SquareNav.js (100%) rename squarenotsquare/{ => src}/navigation/SquareStack.js (100%) rename squarenotsquare/{ => src}/realm/dbAPI.js (100%) rename squarenotsquare/{ => src}/realm/dbInit.js (100%) rename squarenotsquare/{ => src}/realm/entities/Score.js (100%) rename squarenotsquare/{ => src}/realm/entities/System.js (100%) rename squarenotsquare/{ => src}/realm/entities/User.js (100%) rename squarenotsquare/{ => src}/realm/migrations/MigrateV0.js (100%) rename squarenotsquare/{ => src}/realm/migrations/MigrateV1.js (100%) rename squarenotsquare/{ => src}/realm/repos/ScoreRepo.js (100%) rename squarenotsquare/{ => src}/realm/repos/SystemRepo.js (100%) rename squarenotsquare/{ => src}/realm/repos/UserRepo.js (100%) rename squarenotsquare/{ => src}/redux/CreateStore.js (100%) rename squarenotsquare/{ => src}/redux/actions/SystemActions.js (100%) rename squarenotsquare/{ => src}/redux/actions/UserActions.js (100%) rename squarenotsquare/{ => src}/redux/reducers/NavReducer.js (100%) rename squarenotsquare/{ => src}/redux/reducers/RootReducer.js (100%) rename squarenotsquare/{ => src}/redux/reducers/SystemReducer.js (100%) rename squarenotsquare/{ => src}/redux/reducers/UserReducer.js (100%) rename squarenotsquare/{ => src}/redux/types/SystemTypes.js (100%) rename squarenotsquare/{ => src}/screens/Game.js (100%) rename squarenotsquare/{ => src}/screens/HighScore.js (100%) rename squarenotsquare/{ => src}/screens/Home.js (100%) rename squarenotsquare/{ => src}/screens/Settings.js (100%) rename squarenotsquare/{ => src}/screens/Splash.js (100%) rename squarenotsquare/{ => src}/screens/styles/AppStyles.js (100%) rename squarenotsquare/{ => src}/services/Keystore.js (100%) rename squarenotsquare/{ => src}/themes/Colors.js (100%) rename squarenotsquare/{ => src}/themes/Fonts.js (100%) rename squarenotsquare/{ => src}/themes/Icons.js (100%) rename squarenotsquare/{ => src}/themes/Metrics.js (100%) diff --git a/squarenotsquare/Launcher.js b/squarenotsquare/Launcher.js index b77bcda..2e71fc1 100644 --- a/squarenotsquare/Launcher.js +++ b/squarenotsquare/Launcher.js @@ -1,6 +1,6 @@ import React from 'react'; import {Provider} from 'react-redux'; -import SquareStack from './navigation/SquareStack'; +import SquareStack from './src/navigation/SquareStack'; function SquareNotSquare(props){ return ( diff --git a/squarenotsquare/__mock__/mockDB.js b/squarenotsquare/__mock__/mockDB.js new file mode 100644 index 0000000..ac497c0 --- /dev/null +++ b/squarenotsquare/__mock__/mockDB.js @@ -0,0 +1,3 @@ +export async function initDB() { + return null; +} \ No newline at end of file diff --git a/squarenotsquare/__mock__/mockRealmObject.js b/squarenotsquare/__mock__/mockRealmObject.js index 22c409b..294f642 100644 --- a/squarenotsquare/__mock__/mockRealmObject.js +++ b/squarenotsquare/__mock__/mockRealmObject.js @@ -1,6 +1,6 @@ -import { Score } from "../realm/entities/Score"; -import { System } from "../realm/entities/System"; -import { User } from "../realm/entities/User"; +import { Score } from "../src/realm/entities/Score"; +import { System } from "../src/realm/entities/System"; +import { User } from "../src/realm/entities/User"; export class MockRealm{ diff --git a/squarenotsquare/__tests__/App-test.js b/squarenotsquare/__tests__/App-test.js index f881683..13e9a2a 100644 --- a/squarenotsquare/__tests__/App-test.js +++ b/squarenotsquare/__tests__/App-test.js @@ -7,12 +7,12 @@ import React from 'react'; // Note: test renderer must be required after react-native. import renderer from 'react-test-renderer'; -import SquareStack from '../navigation/SquareStack'; -import Game from '../screens/Game'; -import HighScore from '../screens/HighScore'; -import Home from '../screens/Home'; -import Settings from '../screens/Settings'; -import Splash from '../screens/Splash'; +import SquareStack from '../src/navigation/SquareStack'; +import Game from '../src/screens/Game'; +import HighScore from '../src/screens/HighScore'; +import Home from '../src/screens/Home'; +import Settings from '../src/screens/Settings'; +import Splash from '../src/screens/Splash'; it('renders square stack', () => { renderer.create(); diff --git a/squarenotsquare/__tests__/Migration-test.js b/squarenotsquare/__tests__/Migration-test.js index 345340a..565c82f 100644 --- a/squarenotsquare/__tests__/Migration-test.js +++ b/squarenotsquare/__tests__/Migration-test.js @@ -1,6 +1,6 @@ -import { System } from "../realm/entities/System"; -import { migratev0 } from "../realm/migrations/MigrateV0"; -import { migratev1 } from "../realm/migrations/MigrateV1"; +import { System } from "../src/realm/entities/System"; +import { migratev0 } from "../src/realm/migrations/MigrateV0"; +import { migratev1 } from "../src/realm/migrations/MigrateV1"; import { MockRealm } from "../__mock__/mockRealmObject"; test('Realm migrates to V0', () => { diff --git a/squarenotsquare/__tests__/Redux-test.js b/squarenotsquare/__tests__/Redux-test.js index e69de29..9b1a922 100644 --- a/squarenotsquare/__tests__/Redux-test.js +++ b/squarenotsquare/__tests__/Redux-test.js @@ -0,0 +1,16 @@ +import 'react-native'; +import React from 'react'; +import initStore from '../src/redux/CreateStore'; +import appInit from '../src/redux/actions/SystemActions'; +import { APP_INIT } from '../src/edux/types/SystemTypes'; + +const flushPromises = () => new Promise(setImmediate); + +test('starts redux store', () => { + const reduxStore = initStore(); + reduxStore.dispatch(appInit()) + .then(() => { + const actualActions = reduxStore.getActions().map(action = action.type); + expect(actualActions).to.eql(APP_INIT); + }); +}); \ No newline at end of file diff --git a/squarenotsquare/index.js b/squarenotsquare/index.js index 7b774ac..e99c319 100644 --- a/squarenotsquare/index.js +++ b/squarenotsquare/index.js @@ -2,8 +2,8 @@ import React from 'react'; import {AppRegistry} from 'react-native'; import {name as appName} from './app.json'; import SquareNotSquare from './Launcher'; -import configStore from './redux/CreateStore'; -import { appInit } from './redux/actions/SystemActions'; +import configStore from './src/redux/CreateStore'; +import { appInit } from './src/redux/actions/SystemActions'; const squareStore = configStore; squareStore.dispatch(appInit()); diff --git a/squarenotsquare/jest.config.js b/squarenotsquare/jest.config.js index 4f67572..3c4ad23 100644 --- a/squarenotsquare/jest.config.js +++ b/squarenotsquare/jest.config.js @@ -2,16 +2,14 @@ module.exports = { // setupFiles: ['./jestSetup.js'], preset: 'react-native', verbose: true, - setupFiles: ["./node_modules/react-native-gesture-handler/jestSetup.js"], - moduleDirectories: ['node_modules'], + setupFiles: ['./node_modules/react-native-gesture-handler/jestSetup.js'], + moduleDirectories: ['node_modules', 'src'], moduleNameMapper: { // '@react-native-firebase/messaging: '/__mock__/mockFirebase.js', - "\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mock__/file.js" + '\\.(jpg|ico|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mock__/file.js' }, - /* transform: { - '^.+\\(ts|tsx)?$': 'ts-jest', - '^.+\\(js|jsx)?$': 'babel-jest', + '^.+\\.(ts|tsx)?$': 'ts-jest', + '^.+\\.(js|jsx)$': 'babel-jest', } - */ } \ No newline at end of file diff --git a/squarenotsquare/libs/Random.js b/squarenotsquare/src/libs/Random.js similarity index 100% rename from squarenotsquare/libs/Random.js rename to squarenotsquare/src/libs/Random.js diff --git a/squarenotsquare/navigation/SquareNav.js b/squarenotsquare/src/navigation/SquareNav.js similarity index 100% rename from squarenotsquare/navigation/SquareNav.js rename to squarenotsquare/src/navigation/SquareNav.js diff --git a/squarenotsquare/navigation/SquareStack.js b/squarenotsquare/src/navigation/SquareStack.js similarity index 100% rename from squarenotsquare/navigation/SquareStack.js rename to squarenotsquare/src/navigation/SquareStack.js diff --git a/squarenotsquare/realm/dbAPI.js b/squarenotsquare/src/realm/dbAPI.js similarity index 100% rename from squarenotsquare/realm/dbAPI.js rename to squarenotsquare/src/realm/dbAPI.js diff --git a/squarenotsquare/realm/dbInit.js b/squarenotsquare/src/realm/dbInit.js similarity index 100% rename from squarenotsquare/realm/dbInit.js rename to squarenotsquare/src/realm/dbInit.js diff --git a/squarenotsquare/realm/entities/Score.js b/squarenotsquare/src/realm/entities/Score.js similarity index 100% rename from squarenotsquare/realm/entities/Score.js rename to squarenotsquare/src/realm/entities/Score.js diff --git a/squarenotsquare/realm/entities/System.js b/squarenotsquare/src/realm/entities/System.js similarity index 100% rename from squarenotsquare/realm/entities/System.js rename to squarenotsquare/src/realm/entities/System.js diff --git a/squarenotsquare/realm/entities/User.js b/squarenotsquare/src/realm/entities/User.js similarity index 100% rename from squarenotsquare/realm/entities/User.js rename to squarenotsquare/src/realm/entities/User.js diff --git a/squarenotsquare/realm/migrations/MigrateV0.js b/squarenotsquare/src/realm/migrations/MigrateV0.js similarity index 100% rename from squarenotsquare/realm/migrations/MigrateV0.js rename to squarenotsquare/src/realm/migrations/MigrateV0.js diff --git a/squarenotsquare/realm/migrations/MigrateV1.js b/squarenotsquare/src/realm/migrations/MigrateV1.js similarity index 100% rename from squarenotsquare/realm/migrations/MigrateV1.js rename to squarenotsquare/src/realm/migrations/MigrateV1.js diff --git a/squarenotsquare/realm/repos/ScoreRepo.js b/squarenotsquare/src/realm/repos/ScoreRepo.js similarity index 100% rename from squarenotsquare/realm/repos/ScoreRepo.js rename to squarenotsquare/src/realm/repos/ScoreRepo.js diff --git a/squarenotsquare/realm/repos/SystemRepo.js b/squarenotsquare/src/realm/repos/SystemRepo.js similarity index 100% rename from squarenotsquare/realm/repos/SystemRepo.js rename to squarenotsquare/src/realm/repos/SystemRepo.js diff --git a/squarenotsquare/realm/repos/UserRepo.js b/squarenotsquare/src/realm/repos/UserRepo.js similarity index 100% rename from squarenotsquare/realm/repos/UserRepo.js rename to squarenotsquare/src/realm/repos/UserRepo.js diff --git a/squarenotsquare/redux/CreateStore.js b/squarenotsquare/src/redux/CreateStore.js similarity index 100% rename from squarenotsquare/redux/CreateStore.js rename to squarenotsquare/src/redux/CreateStore.js diff --git a/squarenotsquare/redux/actions/SystemActions.js b/squarenotsquare/src/redux/actions/SystemActions.js similarity index 100% rename from squarenotsquare/redux/actions/SystemActions.js rename to squarenotsquare/src/redux/actions/SystemActions.js diff --git a/squarenotsquare/redux/actions/UserActions.js b/squarenotsquare/src/redux/actions/UserActions.js similarity index 100% rename from squarenotsquare/redux/actions/UserActions.js rename to squarenotsquare/src/redux/actions/UserActions.js diff --git a/squarenotsquare/redux/reducers/NavReducer.js b/squarenotsquare/src/redux/reducers/NavReducer.js similarity index 100% rename from squarenotsquare/redux/reducers/NavReducer.js rename to squarenotsquare/src/redux/reducers/NavReducer.js diff --git a/squarenotsquare/redux/reducers/RootReducer.js b/squarenotsquare/src/redux/reducers/RootReducer.js similarity index 100% rename from squarenotsquare/redux/reducers/RootReducer.js rename to squarenotsquare/src/redux/reducers/RootReducer.js diff --git a/squarenotsquare/redux/reducers/SystemReducer.js b/squarenotsquare/src/redux/reducers/SystemReducer.js similarity index 100% rename from squarenotsquare/redux/reducers/SystemReducer.js rename to squarenotsquare/src/redux/reducers/SystemReducer.js diff --git a/squarenotsquare/redux/reducers/UserReducer.js b/squarenotsquare/src/redux/reducers/UserReducer.js similarity index 100% rename from squarenotsquare/redux/reducers/UserReducer.js rename to squarenotsquare/src/redux/reducers/UserReducer.js diff --git a/squarenotsquare/redux/types/SystemTypes.js b/squarenotsquare/src/redux/types/SystemTypes.js similarity index 100% rename from squarenotsquare/redux/types/SystemTypes.js rename to squarenotsquare/src/redux/types/SystemTypes.js diff --git a/squarenotsquare/screens/Game.js b/squarenotsquare/src/screens/Game.js similarity index 100% rename from squarenotsquare/screens/Game.js rename to squarenotsquare/src/screens/Game.js diff --git a/squarenotsquare/screens/HighScore.js b/squarenotsquare/src/screens/HighScore.js similarity index 100% rename from squarenotsquare/screens/HighScore.js rename to squarenotsquare/src/screens/HighScore.js diff --git a/squarenotsquare/screens/Home.js b/squarenotsquare/src/screens/Home.js similarity index 100% rename from squarenotsquare/screens/Home.js rename to squarenotsquare/src/screens/Home.js diff --git a/squarenotsquare/screens/Settings.js b/squarenotsquare/src/screens/Settings.js similarity index 100% rename from squarenotsquare/screens/Settings.js rename to squarenotsquare/src/screens/Settings.js diff --git a/squarenotsquare/screens/Splash.js b/squarenotsquare/src/screens/Splash.js similarity index 100% rename from squarenotsquare/screens/Splash.js rename to squarenotsquare/src/screens/Splash.js diff --git a/squarenotsquare/screens/styles/AppStyles.js b/squarenotsquare/src/screens/styles/AppStyles.js similarity index 100% rename from squarenotsquare/screens/styles/AppStyles.js rename to squarenotsquare/src/screens/styles/AppStyles.js diff --git a/squarenotsquare/services/Keystore.js b/squarenotsquare/src/services/Keystore.js similarity index 100% rename from squarenotsquare/services/Keystore.js rename to squarenotsquare/src/services/Keystore.js diff --git a/squarenotsquare/themes/Colors.js b/squarenotsquare/src/themes/Colors.js similarity index 100% rename from squarenotsquare/themes/Colors.js rename to squarenotsquare/src/themes/Colors.js diff --git a/squarenotsquare/themes/Fonts.js b/squarenotsquare/src/themes/Fonts.js similarity index 100% rename from squarenotsquare/themes/Fonts.js rename to squarenotsquare/src/themes/Fonts.js diff --git a/squarenotsquare/themes/Icons.js b/squarenotsquare/src/themes/Icons.js similarity index 100% rename from squarenotsquare/themes/Icons.js rename to squarenotsquare/src/themes/Icons.js diff --git a/squarenotsquare/themes/Metrics.js b/squarenotsquare/src/themes/Metrics.js similarity index 100% rename from squarenotsquare/themes/Metrics.js rename to squarenotsquare/src/themes/Metrics.js