Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wide buttons #1104

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
309 commits
Select commit Hold shift + click to select a range
40ce229
don't displayErrorMsg in storage.ts
JGreenlee Oct 11, 2023
37ac065
remove unneeded comment
JGreenlee Oct 11, 2023
cfd7829
show error if 'db' not defined in clientStats.ts
JGreenlee Oct 11, 2023
ea2b8c5
re-implement functions of commHelper
JGreenlee Oct 12, 2023
6ffb926
Fixing enketo label filters
sebastianbarry Oct 12, 2023
641e8aa
don't "processErrorMessages" in commHelper
JGreenlee Oct 12, 2023
03dc94e
update comment in commHelper.test.ts
JGreenlee Oct 12, 2023
83a4939
Removed stale code
the-bay-kay Oct 12, 2023
acb36aa
cordovaMocks: use cordova-ios version from json
JGreenlee Oct 12, 2023
e546d73
commHelper: promisify 'registerUser'
JGreenlee Oct 12, 2023
37be426
Adding default label-options
sebastianbarry Oct 12, 2023
6508517
Adding examples of multilabel translations to en.json
sebastianbarry Oct 12, 2023
9d83cc1
delete old angular service
jiji14 Oct 12, 2023
bc74d12
add new input-matcher service
jiji14 Oct 12, 2023
eb0d63e
call input matcher functions from the new input-matcher service
jiji14 Oct 12, 2023
9c518f6
add input-matcher unit test (not done)
jiji14 Oct 12, 2023
2963e12
Rewrote unifiedDataLoader into typscript functions
the-bay-kay Oct 12, 2023
5f530f5
Merge pull request #1040 from JGreenlee/rewrite-services-sept2023
shankari Oct 13, 2023
4d86b37
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Oct 13, 2023
f39a357
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Oct 13, 2023
1030813
Merge branch 'onboarding_routing_sept_2023' of https://github.com/e-m…
JGreenlee Oct 13, 2023
36cfff6
Improved TS, generalized getUnifiedData
the-bay-kay Oct 13, 2023
d9936f1
delete old input-matcher angular service
jiji14 Oct 13, 2023
631de70
Add getNotDeletedCandidates input & output type
jiji14 Oct 13, 2023
7148ac6
remove input-matcher.js file
jiji14 Oct 13, 2023
16673e8
Done with input-matcher.test
jiji14 Oct 13, 2023
f891227
Merge branch 'rewrite-input-matcher' into input-matcher-rewrite
jiji14 Oct 13, 2023
b7abd98
Generalized combinePromises, improved TS
the-bay-kay Oct 13, 2023
3ae8150
Merge pull request #1067 from JGreenlee/merge-onboarding-servicerewrite
shankari Oct 14, 2023
7e85ea2
Merge branch 'service_rewrite_2023' into services_rewrite
JGreenlee Oct 16, 2023
95d4f64
Merge branch 'service_rewrite_2023' into input-matcher-rewrite
JGreenlee Oct 16, 2023
4f3d9fb
fix indentations
Oct 16, 2023
185813f
better object declaration
Oct 16, 2023
655ddda
additional indentation improvement
Oct 16, 2023
4026423
remove logError
Oct 16, 2023
b8ec27d
add comments for test inputs
jiji14 Oct 16, 2023
0c1bac8
remove uneeded code
Oct 16, 2023
908cc50
Merge branch 'service_rewrite_2023' into react-testing-setup
jiji14 Oct 16, 2023
82f7be6
json.config.json
jiji14 Oct 17, 2023
6b59491
delete jest.config.json
jiji14 Oct 17, 2023
140ff67
add file to resolve deleted file merge conflict
jiji14 Oct 17, 2023
a289789
delete jest.config.json
jiji14 Oct 17, 2023
dd96275
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Oct 17, 2023
ebb6eae
Adding more thorough ImperialConfig testing
sebastianbarry Oct 17, 2023
36b56da
Correct text in comment
sebastianbarry Oct 17, 2023
202f6db
Adding spaces between slashes in text
sebastianbarry Oct 17, 2023
1bb9055
Merge branch 'new-default-label-options-and-translations' of https://…
sebastianbarry Oct 17, 2023
b43b6a0
remane input-matcher to inputMatcher (follow camelCase rule)
jiji14 Oct 17, 2023
235c088
Merge branch 'input-matcher-rewrite' of https://github.com/jiji14/e-m…
jiji14 Oct 17, 2023
e2a2fde
Merge pull request #1049 from jiji14/react-testing-setup
shankari Oct 17, 2023
ffcc871
move trip related types to 'dairyTypes' file in 'types' directory
jiji14 Oct 17, 2023
9be110d
i18n: fix merge translations if structure differs
JGreenlee Oct 17, 2023
259778a
Changed "typeof x === 'undefined'" to !x
sebastianbarry Oct 17, 2023
0e31d15
remove unused imports from startprefts.js
Oct 17, 2023
4fc3982
convert startprefs from .js to .ts
Oct 17, 2023
416a111
remove all references to angular service, replace with imports
Oct 17, 2023
0584278
add a comment about the notifications
Oct 18, 2023
1d4752d
remove extra line
Oct 18, 2023
e0dc3bb
correct typo
Oct 18, 2023
e60857f
Merge pull request #1057 from sebastianbarry/useImperialConfig-test
shankari Oct 19, 2023
d032ed1
Merge pull request #1062 from sebastianbarry/rewrite-infinite-scroll-…
shankari Oct 19, 2023
8a3320d
make a deep copy for storage
Oct 19, 2023
86fe118
correct outdated comments
Oct 19, 2023
cac185f
add comments and timeout
Oct 19, 2023
4b148c2
fix location of timeout
Oct 19, 2023
d8a3b33
revert uploadSample json file
Oct 19, 2023
1afe3d0
Merge remote-tracking branch 'upstream/service_rewrite_2023' into ser…
Oct 19, 2023
a26536c
updating "keys"
Oct 19, 2023
d8d1a37
update event protocol
Oct 19, 2023
8a99ba9
move plugin calls
Oct 19, 2023
b40761a
Merge remote-tracking branch 'upstream/service_rewrite_2023' into sta…
Oct 19, 2023
e6abae8
Added `types` directory, updated TS
the-bay-kay Oct 19, 2023
1edfc8c
add docstrings for functions
Oct 19, 2023
d4a29b1
first test for startprefs
Oct 20, 2023
40f6b93
test markConsented
Oct 20, 2023
9849fa2
test all functions in sequence
Oct 20, 2023
2c6739a
Remove translations from label-options.json.sample
sebastianbarry Oct 20, 2023
1674d46
Added first unifiedDataLoader test
the-bay-kay Oct 20, 2023
ef4a9d8
Merge remote-tracking branch 'upstream/onboarding_routing_sept_2023' …
Oct 20, 2023
8ab5bf1
add timeout
Oct 20, 2023
8d765d0
Added rudimentary type interfaces for server data
the-bay-kay Oct 20, 2023
0bb95b2
Added types for `/diary/` services!
the-bay-kay Oct 20, 2023
49e1757
Added types for `controlHelper.ts`
the-bay-kay Oct 20, 2023
2e19760
Merge pull request #1065 from sebastianbarry/new-default-label-option…
shankari Oct 20, 2023
f2f0cfb
FETCH -> GET to match HTTP request types
shankari Oct 20, 2023
412a8ce
Merge pull request #1053 from Abby-Wheelis/services_rewrite
shankari Oct 20, 2023
47fa869
Merge pull request #1042 from jiji14/rewrite_angular_service
shankari Oct 20, 2023
182ca27
Merge remote-tracking branch 'upstream/service_rewrite_2023' into add…
Oct 21, 2023
d54731f
add hybrid car
Oct 21, 2023
2c92dbf
resolve merge conflicts by merging upstream
Oct 23, 2023
60caee5
remove "protocol id"
Oct 23, 2023
c1d76ad
update consent/no consent messages
Oct 23, 2023
6dc7e4f
update hybrid kgCo2PerKm
Abby-Wheelis Oct 23, 2023
7dd8ffb
Added tests for combinedPromises
the-bay-kay Oct 24, 2023
446aef3
Merge remote-tracking branch 'upstream/master' into service_rewrite_2023
jiji14 Oct 24, 2023
1907966
Updated tests, formatted test file using Prettier
the-bay-kay Oct 24, 2023
46c1429
Code format changes to unifiedDataLoader.ts
the-bay-kay Oct 24, 2023
dc28f99
Merge branch 'input-matcher-rewrite' of https://github.com/jiji14/e-m…
JGreenlee Oct 25, 2023
1d5f1d5
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Oct 25, 2023
8f76ecf
Merge branch 'input-matcher-rewrite' of https://github.com/jiji14/e-m…
JGreenlee Oct 25, 2023
8712380
use section summary for getDetectedModes
JGreenlee Oct 25, 2023
4f58aa8
re-work methods for checking code
Oct 25, 2023
3130741
remove unneeded type declaration
Oct 25, 2023
39aa2f2
move "after consent"
Oct 25, 2023
657ae34
rework "intro done event"
Oct 25, 2023
a7a75d1
remove unneeded object
Oct 25, 2023
f0da5ea
Updated Object Types
the-bay-kay Oct 26, 2023
c54f939
console.log -> logDebug
Oct 27, 2023
2516b2d
_is_consented assigned but never used
Oct 27, 2023
8bbfb82
add a catch block
Oct 27, 2023
3ddf403
Moved services to separate directory
the-bay-kay Oct 27, 2023
e19a346
less hacky undefined catch
Oct 27, 2023
73abff3
Merge pull request #1089 from e-mission/master
shankari Oct 29, 2023
7338c18
Merge pull request #1083 from Abby-Wheelis/cleanup-qr-checks
shankari Oct 29, 2023
56014a5
Merge pull request #1069 from JGreenlee/fix-merge-translations
shankari Oct 29, 2023
f7716cf
refactor filters: prep to remove buttons services
JGreenlee Oct 29, 2023
4d48aee
map user inputs instead of populating tlEntry objs
JGreenlee Oct 30, 2023
3855a03
remove btn services and survey.ts
JGreenlee Oct 30, 2023
40d3f75
add back verifiability with verifiabilityForTrip()
JGreenlee Oct 30, 2023
49ff385
remove populateCompositeTrips; update types
JGreenlee Oct 30, 2023
a34c219
TripCard: don't show footer if no notes
JGreenlee Oct 30, 2023
c262f6a
remove unused vars in LabelTab
JGreenlee Oct 30, 2023
34b997c
Merge remote-tracking branch 'upstream/service_rewrite_2023' into sta…
Oct 30, 2023
b9de66a
Merge remote-tracking branch 'upstream/service_rewrite_2023' into add…
Oct 30, 2023
ff447d7
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
the-bay-kay Oct 30, 2023
b2d6aa9
add comment and discussion link
Oct 30, 2023
fcbefb1
add comments about naming
Oct 30, 2023
3c23808
remove old imports
Oct 30, 2023
5b725a1
Merge pull request #1075 from Abby-Wheelis/add-hybrid
shankari Oct 30, 2023
651e983
Ran prettier on serverData, added notes on types
the-bay-kay Oct 30, 2023
772f508
Fixed PromiseResolution checks
the-bay-kay Oct 30, 2023
9009517
fix label button showing before appConfig loaded
JGreenlee Oct 31, 2023
fb46586
combine processed+unprocessed survey responses
JGreenlee Oct 31, 2023
aa34ac3
Added tests for promise rejection
the-bay-kay Oct 31, 2023
2e5a61e
Ran unifiedDataLoader files through Prettier
the-bay-kay Oct 31, 2023
af5948b
move LabelTabContext to own file to expand types
JGreenlee Oct 31, 2023
d96ff8d
expand types
JGreenlee Oct 31, 2023
22b80f9
fix diaryHelper.test.ts
JGreenlee Oct 31, 2023
b29dc13
Remove default translation for moped in en.json
sebastianbarry Oct 31, 2023
60abf84
Remove moped as a default mode from the default label-options.json.sa…
sebastianbarry Oct 31, 2023
ea3fb10
create event handler
Oct 31, 2023
d267fcf
change file name
Oct 31, 2023
30c534c
Cleaned out `www/img/` directory
the-bay-kay Oct 31, 2023
7d69847
rewrite pushNotify in react
Oct 31, 2023
56156a0
remove references to old file
Oct 31, 2023
332bfbe
centralize the event names
Oct 31, 2023
a991814
emit AND publish events
Oct 31, 2023
a90af2f
add function descriptions
Oct 31, 2023
09cbaa1
ensure proper initialization
Oct 31, 2023
b1838aa
add tests for customEventHandler
Oct 31, 2023
a6bf881
Merge remote-tracking branch 'origin/startprefs-rewrite' into event-n…
Oct 31, 2023
2dca41e
finish resolving merge conflicts
Oct 31, 2023
1dca6c8
Merge pull request #1091 from sebastianbarry/remove-moped
shankari Nov 1, 2023
bb8f1ec
add rough tests, correct data access
Nov 1, 2023
5fbeac2
increase tests
Nov 1, 2023
c406988
pushnotify relies on events now
Nov 1, 2023
d27aedd
update tests
Nov 1, 2023
82e864b
add docstrings to customEventHandler
Nov 1, 2023
0eb7b4b
test cloud event
Nov 1, 2023
24784db
add timeout to config mock
Nov 1, 2023
46d5ed8
update tests
Nov 1, 2023
4f5e853
sync up test runs
Nov 1, 2023
b9ecdb9
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Nov 1, 2023
081b142
Merge branch 'input-matcher-rewrite' of https://github.com/jiji14/e-m…
JGreenlee Nov 1, 2023
e8075b0
Merge pull request #1072 from Abby-Wheelis/startprefs-rewrite
shankari Nov 2, 2023
38c64c4
Merge remote-tracking branch 'upstream/service_rewrite_2023' into eve…
Nov 2, 2023
e1999fd
rename file
Nov 2, 2023
ede2347
rewrite service to typscript
Nov 2, 2023
cd6dc05
remove / update references
Nov 2, 2023
7b7efc8
add initStoreDeviceSettings call
Nov 2, 2023
78eb704
add more docstrings
Nov 2, 2023
4043a8f
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
jiji14 Nov 2, 2023
61ab881
we no longer need this file with prettier
jiji14 Nov 2, 2023
23cba1c
only check 'www' directory except dist, manual_lib, and json
jiji14 Nov 2, 2023
b92f993
update prettier config
jiji14 Nov 2, 2023
4707d82
add prettier package
jiji14 Nov 2, 2023
bb73676
format the files with prettier
jiji14 Nov 2, 2023
765fa00
Merge pull request #1094 from jiji14/prettier-to-service-rewrite
shankari Nov 2, 2023
3e6d2b0
Add prettier to workflows
jiji14 Nov 2, 2023
72a76fa
add server comm mock
Nov 2, 2023
58c6ce2
Merge branch 'service_rewrite_2023' into input-matcher-rewrite
jiji14 Nov 2, 2023
188d478
start tests
Nov 2, 2023
395940f
resolve prettier merge conflicts
Nov 2, 2023
5e04536
re-prettify merge conflicted files
Nov 2, 2023
956f2d9
Merge remote-tracking branch 'upstream/service_rewrite_2023' into rew…
JGreenlee Nov 2, 2023
9ee44ae
Merge branch 'service_rewrite_2023' into UnifiedDataLoader-rewrite
the-bay-kay Nov 2, 2023
5110845
apply prettier to PR #1086
JGreenlee Nov 2, 2023
f490125
Merge remote-tracking branch 'upstream/service_rewrite_2023' into inp…
jiji14 Nov 2, 2023
b4bc7ab
Run prettier
jiji14 Nov 2, 2023
2dc232f
Merge branch 'service_rewrite_2023' into type_interfaces
the-bay-kay Nov 2, 2023
9cf629e
Updated type appearances with prettier
the-bay-kay Nov 2, 2023
063f5b9
Merge branch 'type_interfaces' into UnifiedDataLoader-rewrite
the-bay-kay Nov 2, 2023
8a5ce8b
updated files with prettier
the-bay-kay Nov 2, 2023
13b7011
Merge pull request #1095 from jiji14/prettier-github-action
shankari Nov 2, 2023
8764701
Merge remote-tracking branch 'upstream/service_rewrite_2023' into eve…
Nov 2, 2023
4393362
prettify recent changes
Nov 2, 2023
f2a8db6
Merge remote-tracking branch 'upstream/service_rewrite_2023' into inp…
jiji14 Nov 3, 2023
1f952f7
remove 'locales' submodule
JGreenlee Nov 3, 2023
1b01692
fix syntax errors and apply prettier
JGreenlee Nov 3, 2023
5eb8d8f
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Nov 3, 2023
bc5c589
update tests so they pass
Nov 3, 2023
1aceb94
complete tests
Nov 3, 2023
9581ca2
remove unused mock code
Nov 3, 2023
9aa89d5
rename remotenotify file
Nov 3, 2023
16c87f0
typescript migration
Nov 3, 2023
68e0701
formatting changes to controller.js
Nov 3, 2023
84064bb
remove angular.isDefined calls
Nov 3, 2023
24b34ee
clean up confirmHelper
JGreenlee Nov 3, 2023
55c313d
add tests for confirmHelper
JGreenlee Nov 3, 2023
b58ee5c
clean up comments and docstrings
Nov 3, 2023
3a5a0f6
Add html files in prettierignore
jiji14 Nov 3, 2023
87de6c2
first two tests function
Nov 3, 2023
b8cb34a
Revert html file before changing formatting
jiji14 Nov 3, 2023
0e2448c
Minor fix to index.html, changed by prettier
the-bay-kay Nov 3, 2023
d9285d3
Ran `prettier` on remaining files
the-bay-kay Nov 3, 2023
dcf35fa
complete writing testing
Nov 3, 2023
b9f1483
Merge pull request #1096 from jiji14/fix-html-prettier
shankari Nov 3, 2023
59503e6
Update www/js/services/unifiedDataLoader.ts
the-bay-kay Nov 6, 2023
9a9cd92
Removed old UnifiedDataLoader
the-bay-kay Nov 6, 2023
2a04319
Merge gitHub change to local repo
the-bay-kay Nov 6, 2023
9b1665a
simplify event name storage
Nov 6, 2023
c25ebb6
directly use alert, for now
Nov 6, 2023
ad68e1b
remove old alerts
Nov 6, 2023
85d2884
swap var for const
Nov 6, 2023
29f44e7
update test
Nov 6, 2023
000f08d
Refactored combinedPromises
the-bay-kay Nov 6, 2023
71bee6f
Prettier cleanup
the-bay-kay Nov 6, 2023
bafdb47
Update www/js/services/unifiedDataLoader.ts
the-bay-kay Nov 7, 2023
4c2bbf0
add ErrorBoundary to each tab
JGreenlee Nov 9, 2023
0be2234
add logDebug statements in Chart.tsx
JGreenlee Nov 9, 2023
1388eee
add more logging in LabelTab
JGreenlee Nov 9, 2023
94d8933
add logs to MetricsTab
JGreenlee Nov 9, 2023
98a9db6
translations for error msgs just added
JGreenlee Nov 9, 2023
edafd98
Merge pull request #1100 from JGreenlee/bulk-logs-nov2023
shankari Nov 9, 2023
db08c76
Merge pull request #1061 from jiji14/input-matcher-rewrite
shankari Nov 10, 2023
99534bf
Merge branch 'service_rewrite_2023' into UnifiedDataLoader-rewrite
shankari Nov 10, 2023
77d2ad1
Merge branch 'service_rewrite_2023' into event-notif-rewrite
shankari Nov 10, 2023
a60b1e2
Merge branch 'service_rewrite_2023' of https://github.com/e-mission/e…
JGreenlee Nov 10, 2023
ccb50c5
Merge pull request #1093 from Abby-Wheelis/event-notif-rewrite
shankari Nov 10, 2023
d3e6af2
fix en.json -> "questions"
JGreenlee Nov 10, 2023
69b18cb
remove duplicate 'verifiability' check
JGreenlee Nov 10, 2023
808ab2e
Merge branch 'service_rewrite_2023' into UnifiedDataLoader-rewrite
the-bay-kay Nov 10, 2023
25f7adf
Ran Prettier after merge
the-bay-kay Nov 10, 2023
fa95f97
Fixed imports
the-bay-kay Nov 10, 2023
4992e8d
Merge pull request #1086 from JGreenlee/rewrite-label-btn-services
shankari Nov 10, 2023
c2bb442
Merge branch 'service_rewrite_2023' into UnifiedDataLoader-rewrite
the-bay-kay Nov 10, 2023
7e8f07b
Merge cleanup
the-bay-kay Nov 11, 2023
cf9eee0
Merge pull request #1064 from the-bay-kay/UnifiedDataLoader-rewrite
shankari Nov 11, 2023
3dba39a
Merge pull request #1102 from e-mission/master
shankari Nov 11, 2023
941907a
Fixed buttons
niccolopaganini Nov 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .editorconfig

This file was deleted.

11 changes: 11 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: prettier
on:
pull_request:

jobs:
run-prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: npx prettier --check www

13 changes: 13 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Ignore www/dist, manual_lib, json
www/dist
www/manual_lib
www/json

# Ignore all HTML files:
**/*.html

# This is the pattern to check only www directory
# Ignore all
/*
# but don't ignore all the files in www directory
!/www
10 changes: 10 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"printWidth": 100,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "all",
"bracketSpacing": true,
"bracketSameLine": true,
"endOfLine": "lf",
"semi": true
}
4 changes: 4 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
presets: ['@babel/preset-env', '@babel/preset-typescript', '@babel/preset-react'],
plugins: ['@babel/plugin-transform-flow-strip-types'],
}
19 changes: 19 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module.exports = {
testEnvironment: 'jsdom',
testPathIgnorePatterns: [
"/node_modules/",
"/platforms/",
"/plugins/",
"/lib/",
"/manual_lib/"
],
preset: 'react-native',
transform: {
"^.+\\.(ts|tsx|js|jsx)$": "babel-jest"
},
transformIgnorePatterns: [
"node_modules/(?!((jest-)?react-native(-.*)?|@react-native(-community)?)/)"
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
moduleDirectories: ["node_modules", "src"],
};
15 changes: 0 additions & 15 deletions jest.config.json

This file was deleted.

9 changes: 7 additions & 2 deletions package.serve.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
"@babel/core": "^7.21.3",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-object-rest-spread": "^7.20.7",
"@babel/plugin-transform-flow-strip-types": "^7.22.5",
"@babel/preset-env": "^7.21.4",
"@babel/preset-flow": "^7.21.4",
"@babel/preset-react": "^7.18.6",
"@babel/preset-typescript": "^7.21.4",
"@ionic/cli": "6.20.8",
"@testing-library/react-native": "^12.3.0",
"@types/luxon": "^3.3.0",
"@types/react": "^18.2.20",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.2",
"babel-plugin-angularjs-annotate": "^0.10.0",
"babel-plugin-optional-require": "^0.3.1",
Expand All @@ -35,17 +38,19 @@
"expose-loader": "^4.1.0",
"file-loader": "^6.2.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"phonegap": "9.0.0+cordova.9.0.0",
"process": "^0.11.10",
"sass": "^1.62.1",
"sass-loader": "^13.3.1",
"style-loader": "^3.3.3",
"ts-jest": "^29.1.1",
"ts-loader": "^9.4.2",
"ts-node": "^10.9.1",
"typescript": "^5.0.3",
"url-loader": "^4.1.1",
"webpack": "^5.0.1",
"webpack-cli": "^5.0.1"
"webpack-cli": "^5.0.1",
"prettier": "3.0.3"
},
"dependencies": {
"@react-navigation/native": "^6.1.7",
Expand Down
188 changes: 188 additions & 0 deletions www/__mocks__/cordovaMocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
import packageJsonBuild from '../../package.cordovabuild.json';

export const mockCordova = () => {
window['cordova'] ||= {};
window['cordova'].platformId ||= 'ios';
window['cordova'].platformVersion ||= packageJsonBuild.dependencies['cordova-ios'];
window['cordova'].plugins ||= {};
};

export const mockDevice = () => {
window['device'] ||= {};
window['device'].platform ||= 'ios';
window['device'].version ||= '14.0.0';
};

export const mockGetAppVersion = () => {
const mockGetAppVersion = {
getAppName: () => new Promise((rs, rj) => setTimeout(() => rs('Mock App'), 10)),
getPackageName: () => new Promise((rs, rj) => setTimeout(() => rs('com.example.mockapp'), 10)),
getVersionCode: () => new Promise((rs, rj) => setTimeout(() => rs('123'), 10)),
getVersionNumber: () => new Promise((rs, rj) => setTimeout(() => rs('1.2.3'), 10)),
};
window['cordova'] ||= {};
window['cordova'].getAppVersion = mockGetAppVersion;
};

export const mockFile = () => {
window['cordova'].file = {
dataDirectory: '../path/to/data/directory',
applicationStorageDirectory: '../path/to/app/storage/directory',
};
};

//for consent document
const _storage = {};

export const mockBEMUserCache = () => {
const _cache = {};
const messages = [];
const mockBEMUserCache = {
getLocalStorage: (key: string, isSecure: boolean) => {
return new Promise((rs, rj) =>
setTimeout(() => {
rs(_cache[key]);
}, 100),
);
},
putLocalStorage: (key: string, value: any) => {
return new Promise<void>((rs, rj) =>
setTimeout(() => {
_cache[key] = value;
rs();
}, 100),
);
},
removeLocalStorage: (key: string) => {
return new Promise<void>((rs, rj) =>
setTimeout(() => {
delete _cache[key];
rs();
}, 100),
);
},
clearAll: () => {
return new Promise<void>((rs, rj) =>
setTimeout(() => {
for (let p in _cache) delete _cache[p];
for (let doc in _storage) delete _storage[doc];
rs();
}, 100),
);
},
listAllLocalStorageKeys: () => {
return new Promise<string[]>((rs, rj) =>
setTimeout(() => {
rs(Object.keys(_cache));
}, 100),
);
},
listAllUniqueKeys: () => {
return new Promise<string[]>((rs, rj) =>
setTimeout(() => {
rs(Object.keys(_cache));
}, 100),
);
},
putMessage: (key: string, value: any) => {
return new Promise<void>((rs, rj) =>
setTimeout(() => {
messages.push({ key, value });
rs();
}, 100),
);
},
getAllMessages: (key: string, withMetadata?: boolean) => {
return new Promise<any[]>((rs, rj) =>
setTimeout(() => {
rs(messages.filter((m) => m.key == key).map((m) => m.value));
}, 100),
);
},
getDocument: (key: string, withMetadata?: boolean) => {
return new Promise<any[]>((rs, rj) =>
setTimeout(() => {
rs(_storage[key]);
}, 100),
);
},
isEmptyDoc: (doc) => {
if (doc == undefined) {
return true;
}
let string = doc.toString();
if (string.length == 0) {
return true;
} else {
return false;
}
},
};
window['cordova'] ||= {};
window['cordova'].plugins ||= {};
window['cordova'].plugins.BEMUserCache = mockBEMUserCache;
};

export const mockBEMDataCollection = () => {
const mockBEMDataCollection = {
markConsented: (consentDoc) => {
setTimeout(() => {
_storage['config/consent'] = consentDoc;
}, 100);
},
getConfig: () => {
return new Promise<any>((rs, rj) => {
setTimeout(() => {
rs({ ios_use_remote_push_for_sync: true });
}, 100);
});
},
handleSilentPush: () => {
return new Promise<void>((rs, rj) =>
setTimeout(() => {
rs();
}, 100),
);
},
};
window['cordova'] ||= {};
window['cordova'].plugins.BEMDataCollection = mockBEMDataCollection;
};

export const mockBEMServerCom = () => {
const mockBEMServerCom = {
postUserPersonalData: (actionString, typeString, updateDoc, rs, rj) => {
setTimeout(() => {
console.log('set in mock', updateDoc);
_storage['user_data'] = updateDoc;
rs();
}, 100);
},

getUserPersonalData: (actionString, rs, rj) => {
setTimeout(() => {
rs(_storage['user_data']);
}, 100);
},
};
window['cordova'].plugins.BEMServerComm = mockBEMServerCom;
};

let _url_stash = '';

export const mockInAppBrowser = () => {
const mockInAppBrowser = {
open: (url: string, mode: string, options: {}) => {
_url_stash = url;
},
};
window['cordova'].InAppBrowser = mockInAppBrowser;
};

export const getURL = () => {
return _url_stash;
};

export const clearURL = () => {
_url_stash = '';
};
21 changes: 21 additions & 0 deletions www/__mocks__/fileSystemMocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export const mockFileSystem = () => {
window['resolveLocalFileSystemURL'] = function (parentDir, handleFS) {
const fs = {
filesystem: {
root: {
getFile: (path, options, onSuccess) => {
let fileEntry = {
file: (handleFile) => {
let file = new File(['this is a mock'], 'loggerDB');
handleFile(file);
},
};
onSuccess(fileEntry);
},
},
},
};
console.log('in mock, fs is ', fs, ' get File is ', fs.filesystem.root.getFile);
handleFS(fs);
};
};
19 changes: 19 additions & 0 deletions www/__mocks__/globalMocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
export const mockLogger = () => {
window['Logger'] = { log: console.log };
};

let alerts = [];

export const mockAlert = () => {
window['alert'] = (message) => {
alerts.push(message);
};
};

export const clearAlerts = () => {
alerts = [];
};

export const getAlerts = () => {
return alerts;
};
33 changes: 33 additions & 0 deletions www/__mocks__/pushNotificationMocks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
let notifSettings;
let onList: any = {};
let called = null;

export const mockPushNotification = () => {
window['PushNotification'] = {
init: (settings: Object) => {
notifSettings = settings;
return {
on: (event: string, callback: Function) => {
onList[event] = callback;
},
finish: (content: any, errorFcn: Function, notID: any) => {
called = notID;
},
};
},
};
};

export const clearNotifMock = function () {
notifSettings = {};
onList = {};
called = null;
};

export const getOnList = function () {
return onList;
};

export const getCalled = function () {
return called;
};
Loading
Loading