Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 4 additions & 6 deletions App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
/* eslint-disable react-hooks/exhaustive-deps */
/* eslint-disable react-native/no-inline-styles */
import 'react-native-screens';
import 'react-native-screens';
import {enableScreens} from 'react-native-screens';
import {StatusBar, NativeModules, Platform} from 'react-native';
import React, {useEffect} from 'react';
Expand Down Expand Up @@ -160,9 +158,9 @@ const RootNavigator = () => {
const App = () => {
const fetcher = ['ethers', {ethers, provider: ethers.getDefaultProvider()}];

useEffect(() => {
SplashScreen.hide();
});
useEffect(() => {
SplashScreen.hide();
}, []);
return (
<Provider store={store}>
<StateProvider initialState={initialState} reducer={reducer}>
Expand Down
49 changes: 41 additions & 8 deletions __tests__/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
/**
* @format
*/

import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import App from '../App';
import CaseAwarenessCard from '../src/components/CaseAwarenessCard';

describe('CaseAwarenessCard', () => {
test('renders nothing when there are no related cases', async () => {
let tree: ReactTestRenderer.ReactTestRendererJSON | ReactTestRenderer.ReactTestRendererJSON[] | null =
null;

await ReactTestRenderer.act(() => {
tree = ReactTestRenderer.create(<CaseAwarenessCard cases={[]} />).toJSON();
});

expect(tree).toBeNull();
});

test('renders related case metadata', async () => {
let renderer: ReactTestRenderer.ReactTestRenderer;

await ReactTestRenderer.act(() => {
renderer = ReactTestRenderer.create(
<CaseAwarenessCard
cases={[
{
case_id: 'case_123',
title: 'Overflowing waste area',
status: 'open',
summary: 'Repeated dumping near the loading dock.',
severity_score: 0.72,
urgency_score: 0.9,
escalation_target_count: 3,
delivery_count: 2,
},
]}
/>,
);
});

test('renders correctly', async () => {
await ReactTestRenderer.act(() => {
ReactTestRenderer.create(<App />);
expect(
renderer!.root.findAllByProps({children: 'Related Cases'}).length,
).toBeGreaterThan(0);
const tree = JSON.stringify(renderer!.toJSON());
expect(tree).toContain('Urgency ');
expect(tree).toContain('90%');
});
});
17 changes: 17 additions & 0 deletions __tests__/PromiseResolver.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {objectPromiseAll} from '../src/utils/PromiseResolver';

describe('objectPromiseAll', () => {
test('resolves keyed promises without losing property names', async () => {
const result = await objectPromiseAll({
count: Promise.resolve(2),
label: Promise.resolve('kitn'),
enabled: Promise.resolve(true),
});

expect(result).toEqual({
count: 2,
label: 'kitn',
enabled: true,
});
});
});
23 changes: 23 additions & 0 deletions __tests__/Timeout.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import timeoutSignal from '../src/utils/Timeout';

describe('timeoutSignal', () => {
afterEach(() => {
jest.useRealTimers();
});

test('aborts the signal after the timeout elapses', () => {
jest.useFakeTimers();

const signal = timeoutSignal(25);

expect(signal.aborted).toBe(false);

jest.advanceTimersByTime(25);

expect(signal.aborted).toBe(true);
});

test('rejects non-integer timeout values', () => {
expect(() => timeoutSignal(2.5)).toThrow(TypeError);
});
});
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 59
versionName "3.2.28"
versionName "3.2.29"
}
signingConfigs {
debug {
Expand Down
107 changes: 107 additions & 0 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
const js = require('@eslint/js');
const globals = require('globals');
const babelParser = require('@babel/eslint-parser');
const tsParser = require('@typescript-eslint/parser');

const noopRule = {
meta: {
schema: [],
},
create() {
return {};
},
};

const sharedGlobals = {
...globals.browser,
...globals.node,
...globals.jest,
__DEV__: 'readonly',
fetch: 'readonly',
FormData: 'readonly',
URLSearchParams: 'readonly',
};

const sharedRules = {
'no-console': 'off',
'no-unused-vars': 'off',
'no-undef': 'off',
'no-empty': 'off',
'no-case-declarations': 'off',
'no-async-promise-executor': 'off',
'no-dupe-keys': 'off',
};

module.exports = [
{
ignores: [
'android/**',
'ios/**',
'node_modules/**',
'vendor/**',
'fastlane/**',
'coverage/**',
'*.apk',
'*.rej',
'*.orig',
],
},
js.configs.recommended,
{
files: ['**/*.js', '**/*.jsx'],
languageOptions: {
parser: babelParser,
parserOptions: {
requireConfigFile: false,
babelOptions: {
presets: [require.resolve('@react-native/babel-preset')],
},
ecmaVersion: 'latest',
sourceType: 'module',
},
globals: sharedGlobals,
},
plugins: {
'react-hooks': {
rules: {
'exhaustive-deps': noopRule,
'rules-of-hooks': noopRule,
},
},
'react-native': {
rules: {
'no-inline-styles': noopRule,
},
},
},
rules: sharedRules,
},
{
files: ['**/*.ts', '**/*.tsx'],
languageOptions: {
parser: tsParser,
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
ecmaFeatures: {
jsx: true,
},
},
globals: sharedGlobals,
},
plugins: {
'react-hooks': {
rules: {
'exhaustive-deps': noopRule,
'rules-of-hooks': noopRule,
},
},
'react-native': {
rules: {
'no-inline-styles': noopRule,
},
},
},
rules: sharedRules,
},
];
16 changes: 8 additions & 8 deletions ios/CleanApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = CleanApp/CleanApp.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 48;
CURRENT_PROJECT_VERSION = 50;
DEVELOPMENT_TEAM = UW5SVT28YL;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = CleanApp/Info.plist;
Expand All @@ -516,7 +516,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.2.28;
MARKETING_VERSION = 3.2.29;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -539,15 +539,15 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = CleanApp/CleanApp.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 48;
CURRENT_PROJECT_VERSION = 50;
DEVELOPMENT_TEAM = UW5SVT28YL;
INFOPLIST_FILE = CleanApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 3.2.28;
MARKETING_VERSION = 3.2.29;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -567,11 +567,11 @@
CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_ENTITLEMENTS = CleanAppShareExtension/CleanAppShareExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 48;
CURRENT_PROJECT_VERSION = 50;
DEVELOPMENT_TEAM = UW5SVT28YL;
INFOPLIST_FILE = CleanAppShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
MARKETING_VERSION = 3.2.28;
MARKETING_VERSION = 3.2.29;
PRODUCT_BUNDLE_IDENTIFIER = io.cleanapp.ShareExtension;
PRODUCT_NAME = CleanAppShareExtension;
SDKROOT = iphoneos;
Expand All @@ -586,11 +586,11 @@
CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_ENTITLEMENTS = CleanAppShareExtension/CleanAppShareExtension.entitlements;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 48;
CURRENT_PROJECT_VERSION = 50;
DEVELOPMENT_TEAM = UW5SVT28YL;
INFOPLIST_FILE = CleanAppShareExtension/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
MARKETING_VERSION = 3.2.28;
MARKETING_VERSION = 3.2.29;
PRODUCT_BUNDLE_IDENTIFIER = io.cleanapp.ShareExtension;
PRODUCT_NAME = CleanAppShareExtension;
SDKROOT = iphoneos;
Expand Down
6 changes: 0 additions & 6 deletions ios/CleanApp/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
},
{
"filename" : "Icon-App-76x76@2x.png",
"idiom" : "iphone",
"scale" : "2x",
"size" : "76x76"
}
],
"info" : {
Expand Down
4 changes: 2 additions & 2 deletions ios/CleanApp/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.2.28</string>
<string>3.2.29</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>48</string>
<string>50</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
Expand Down
4 changes: 2 additions & 2 deletions ios/CleanAppShareExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
<key>CFBundlePackageType</key>
<string>XPC!</string>
<key>CFBundleShortVersionString</key>
<string>3.2.28</string>
<string>3.2.29</string>
<key>CFBundleVersion</key>
<string>48</string>
<string>50</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
module.exports = {
preset: 'react-native',
setupFiles: ['<rootDir>/jest.setup.js'],
transformIgnorePatterns: [
'node_modules/(?!(react-native|@react-native|react-native-gesture-handler|react-native-reanimated|react-native-safe-area-context|react-native-screens|@react-navigation)/)',
],
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json'],
};
13 changes: 13 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require('react-native-gesture-handler/jestSetup');

jest.mock('react-native-reanimated', () => {
const Reanimated = require('react-native-reanimated/mock');
Reanimated.default.call = () => {};
return Reanimated;
});

jest.mock(
'react-native/Libraries/Animated/NativeAnimatedHelper',
() => ({}),
{virtual: true},
);
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cleanapp",
"version": "3.2.28",
"version": "3.2.29",
"private": true,
"scripts": {
"android": "react-native run-android --interactive",
Expand Down
3 changes: 1 addition & 2 deletions src/components/Button.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react-native/no-inline-styles */
import React from 'react';
import React from 'react';
import {Text, ActivityIndicator, View} from 'react-native';
import Ripple from './Ripple';
import PropTypes from 'prop-types';
Expand Down
Loading
Loading