Skip to content

Commit 1a08305

Browse files
authored
Merge pull request #1273 from e-mission/feat/vehicle-library
Initial implementation of the client-side vehicle library
2 parents 1de1c21 + 4e77a14 commit 1a08305

43 files changed

Lines changed: 3065 additions & 84 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ module.exports = {
2020
],
2121
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'],
2222
moduleDirectories: ["node_modules", "src"],
23+
moduleNameMapper: {
24+
"\\.(css|less)$": "<rootDir>/src/__mocks__/styleMock.js",
25+
},
2326
globals: { "__DEV__": false },
2427
setupFiles: ["<rootDir>/src/__mocks__/setupJestEnv.js"],
2528
collectCoverage: true,

package-lock.json

Lines changed: 0 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"scripts": {
1212
"start": "expo start --web --localhost",
13-
"export-dev": "npx expo export -p web -s --output-dir=www && npm run fix-export-paths",
13+
"export-dev": "npx expo export --dev -p web -s --output-dir=www && npm run fix-export-paths",
1414
"export-prod": "npx expo export -p web -s --output-dir=www && npm run fix-export-paths",
1515
"fix-export-paths": "node bin/fix_expo_export_for_cordova.js www",
1616
"build-dev": "npm run export-dev && npx cordova build",

public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<meta charset="utf-8" />
1414
<meta httpEquiv="X-UA-Compatible" content="IE=edge" />
1515
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
16-
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com https://nominatim.openstreetmap.org https://raw.githubusercontent.com http://localhost:* http://10.0.2.2:*; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' https://tile.openstreetmap.org data:">
16+
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: gap: https://ssl.gstatic.com https://nominatim.openstreetmap.org https://raw.githubusercontent.com https://api.stripe.com http://localhost:* http://10.0.2.2:* ws://localhost/hot ws://localhost/message; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' https://tile.openstreetmap.org data:">
1717
<title>%WEB_TITLE%</title>
1818

1919
<script type="text/javascript" src="cordova.js"></script>

src/__mocks__/cordovaMocks.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -339,17 +339,14 @@ export const mockBEMServerCom = () => {
339339
const mockBEMServerCom = {
340340
pushGetJSON,
341341
postUserPersonalData: (actionString, typeString, updateDoc, rs, rj) => {
342-
setTimeout(() => {
343-
console.log('set in mock', updateDoc);
344-
sessionStorage.setItem(`${BEM_SERVERCOMM}user_data`, JSON.stringify(updateDoc));
345-
rs();
346-
});
342+
const msgFiller = (m) => {
343+
m[typeString] = updateDoc;
344+
};
345+
pushGetJSON(actionString, msgFiller, rs, rj);
347346
},
348347
getUserPersonalData: (actionString, rs, rj) => {
349-
setTimeout(() => {
350-
const raw = sessionStorage.getItem(`${BEM_SERVERCOMM}user_data`);
351-
rs(raw === null ? undefined : JSON.parse(raw));
352-
});
348+
const msgFiller = (m) => {};
349+
pushGetJSON(actionString, msgFiller, rs, rj);
353350
},
354351
};
355352
window['cordova'] ||= {};
@@ -398,6 +395,7 @@ export const mockInAppBrowser = () => {
398395
const mockInAppBrowser = {
399396
open: (url: string, mode: string, options: {}) => {
400397
console.log(`Mock InAppBrowser: open ${url} with mode: ${mode} and options:`, options);
398+
window.open(url, '_blank', 'noopener,noreferrer');
401399
},
402400
};
403401
window['cordova'].InAppBrowser = mockInAppBrowser;

src/__mocks__/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

0 commit comments

Comments
 (0)