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

feat: display activity assignment target (M2-7407, M2-7408) #859

Merged
merged 32 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c9f817f
chore: enable prettier validation with eslint
qiushihe Sep 11, 2024
233cf76
chore: remove prettier scripts
qiushihe Sep 16, 2024
a85be04
chore: add type:check script
qiushihe Sep 16, 2024
6e2e523
chore: allow `never` in template expressions
qiushihe Sep 13, 2024
e03acc7
fix: error type casting in template expressions
qiushihe Sep 16, 2024
cd0a0db
fix: couple of dangling promises
qiushihe Sep 16, 2024
5055654
fix: few hook parameter types
qiushihe Sep 16, 2024
3c056a9
fix: some async functions in RefreshService
qiushihe Sep 16, 2024
d03775a
chore: remove unnecessary interface retype types
qiushihe Sep 16, 2024
693e7a6
chore: rename parameter variable name
qiushihe Sep 16, 2024
527fd02
chore: create specific type for api function
qiushihe Sep 16, 2024
9546e8d
feat: display activity assignment target
qiushihe Sep 18, 2024
f728ee7
chore: fix tests
qiushihe Sep 18, 2024
6f6269a
feat: refactor to support target subject ID
Sep 21, 2024
3210cbf
chore: refactor import/export pattern
Sep 25, 2024
d374cf3
fix: collect completions service tests
Sep 25, 2024
d1b9500
fix: react-native-get-random-values import
Sep 26, 2024
2f11741
fix: tests
Sep 27, 2024
03cf372
fix: lint
Sep 30, 2024
08ccb46
chore: clean up jest mocks
Sep 30, 2024
7296728
chore: move all interfaces into own files
Oct 2, 2024
8bcb820
chore: remove husky
Oct 2, 2024
4af9ecb
fix: allow activity with missing record to start
Oct 2, 2024
35946b7
fix: fallback logging for logger send failure
Oct 3, 2024
d1e064f
fix: spelling for a type name
Oct 3, 2024
ac130f7
chore: remove extension from import statements
Oct 3, 2024
f9cf7d5
chore: disable eslint template expression restrictions
Oct 3, 2024
cf75235
fix: mapper tests mock default auto-assign value
Oct 3, 2024
d96ff2d
fix: entities grouping logic
Oct 4, 2024
e3b830f
chore: change reduce to a for-loop
Oct 4, 2024
f034dbe
fix: placement of assignment badge
Oct 6, 2024
09b0a79
fix: entity-event sorting logic
Oct 7, 2024
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 jest.components.jsx

This file was deleted.

4 changes: 2 additions & 2 deletions jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ const jestConfig: JestConfigWithTsJest = {
'node_modules/(?!(jest-)?@?react-native|@react-native-community|@react-navigation|@react-native-device-info|@notifee|@miblanchard/react-native-slider|victory-*|@shopify/react-native-skia|react-native-reanimated|react-redux)',
],
setupFiles: [
'<rootDir>/jest.setup.js',
'<rootDir>/jest.components.jsx',
'<rootDir>/jest.vendor-mocks.js',
'<rootDir>/node_modules/react-native-gesture-handler/jestSetup.js',
'<rootDir>/node_modules/react-native-reanimated/src/reanimated2/jestUtils.ts',
],
setupFilesAfterEnv: ['<rootDir>/jest.setup.js'],
moduleDirectories: ['node_modules', '<rootDir>'],
moduleNameMapper: {
...pathsToModuleNameMapper({
Expand Down
273 changes: 5 additions & 268 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,272 +1,9 @@
import { jest } from '@jest/globals';
import mockRNDeviceInfo from 'react-native-device-info/jest/react-native-device-info-mock';

jest.mock('react-native-file-access', () => {
return {
FileSystem: {
exists: jest.fn(uri => uri.endsWith('.jpg')), // Mock exists() to return true for .jpg files
},
Dirs: {
MainBundleDir: () => {},
CacheDir: () => {},
DocumentDir: () => {},
},
};
});

jest.mock('react-native-reanimated', () => {
const MockAnimation = jest.fn().mockImplementation(() => {
const instance = {
duration: jest.fn(() => instance),
build: jest.fn(() => instance),
};

return instance;
});

return {
createAnimatedComponent: jest.fn(),
SlideInLeft: MockAnimation,
SlideInRight: MockAnimation,
SlideOutLeft: MockAnimation,
SlideOutRight: MockAnimation,
FadeIn: MockAnimation,
FadeOut: MockAnimation,
};
});

jest.mock('react-native-background-fetch', () =>
jest.mock('react-native-background-fetch'),
);
jest.mock('@react-native-firebase/messaging', () =>
jest.mock('@react-native-firebase/messaging'),
);

jest.mock('@georstat/react-native-image-cache', () =>
jest.mock('@georstat/react-native-image-cache'),
);

jest.mock('@react-native-community/geolocation', () =>
jest.mock('@react-native-community/geolocation'),
);

jest.mock('react-native-sensors', () => jest.mock('react-native-sensors'));

jest.mock('react-native-tcp-socket', () => {
return {
createConnection: () => {
return {
on: jest.fn(),
destroy: jest.fn(),
};
},
};
});

jest.mock('@shopify/react-native-skia', () => {
global.SkiaApi = {
Color: jest.fn(),
FontMgr: {
RefDefault: jest.fn(),
},
Point: jest.fn(),
};

global.SkiaValueApi = {
createValue: jest.fn().mockImplementation(v => v),
createDerivedValue: jest.fn(),
createAnimation: jest.fn(),
createClockValue: jest.fn(),
};

return {
Skia: {
Paint: () => ({
setColor: jest.fn(),
setStrokeWidth: jest.fn(),
setStyle: jest.fn(),
}),
Color: jest.fn(),
},
PaintStyle: {
Stroke: 1,
},
};
});

jest.mock('axios', () => {
const defaults = {
headers: {
common: {
'Content-Type': '',
},
},
};

return {
create: () => {
return {
defaults,
};
},
post: () => {},
defaults,
};
});

jest.mock('react-native-permissions', () =>
require('react-native-permissions/mock'),
);

jest.mock('react-native-audio-recorder-player', () => {
return {
DocumentDir: () => {},
fetch: () => {},
base64: () => {},
android: () => {},
ios: () => {},
config: () => {},
session: () => {},
fs: {
dirs: {
MainBundleDir: () => {},
CacheDir: () => {},
DocumentDir: () => {},
},
},
wrap: () => {},
polyfill: () => {},
JSONStream: () => {},
stopPlayer: () => {},
removePlayBackListener: () => {},
startPlayer: () => {},
addPlayBackListener: () => {},
pausePlayer: () => {},
setSubscriptionDuration: () => {},
};
});
import { StorageInstanceManager } from '@app/shared/lib/storages/StorageInstanceManager';

jest.mock('@notifee/react-native', () =>
require('@notifee/react-native/jest-mock'),
);
jest.mock('@react-native-community/netinfo', () => {
return {
getCurrentConnectivity: jest.fn(),
isConnectionMetered: jest.fn(),
addListener: jest.fn(),
removeListeners: jest.fn(),
isConnected: {
fetch: () => {
return Promise.resolve(true);
},
addEventListener: jest.fn(),
removeEventListener: jest.fn(),
},
};
global.beforeEach(() => {
jest
.spyOn(StorageInstanceManager.prototype, 'getStoreEncryptionKey')
.mockReturnValue('12345');
});

jest.mock('react-native-device-info', () => mockRNDeviceInfo);

jest.mock('react-native-gesture-handler', () =>
jest.mock('react-native-gesture-handler'),
);

jest.mock('react-native-localize', () => require('react-native-localize/mock'));

/*
* Turbo modules mocks.
*/

jest.mock('react-native/Libraries/TurboModule/TurboModuleRegistry', () => {
const turboModuleRegistry = jest.requireActual(
'react-native/Libraries/TurboModule/TurboModuleRegistry',
);
return {
...turboModuleRegistry,
getEnforcing: name => {
// List of TurboModules libraries to mock.
const modulesToMock = ['RNLocalize'];

if (modulesToMock.includes(name)) {
return null;
}
return turboModuleRegistry.getEnforcing(name);
},
};
});

jest.mock('react-native-webview', () => {
const React = require('react');
const { View } = require('react-native');

const WebView = props => <View {...props} />;

return {
WebView,
default: WebView,
__esModule: true,
};
});

jest.mock('react-i18next', () => ({
useTranslation: jest.fn().mockImplementation(() => ({
t: jest.fn().mockImplementation(key => key),
})),
}));

jest.mock(
'react-native-audio-recorder-player',
() =>
function () {
return {
stopPlayer: jest.fn(),
removePlayBackListener: jest.fn(),
startPlayer: jest.fn(),
addPlayBackListener: jest.fn(),
pausePlayer: jest.fn(),
setSubscriptionDuration: jest.fn(),
};
},
);

jest.mock('@react-navigation/native', () => ({
...jest.requireActual('@react-navigation/native'),
useFocusEffect: jest.fn(),
}));

class MockMixpanel {
constructor() {}
init() {}
track() {}
identify() {}
getPeople() {}
reset() {}
}

jest.mock('mixpanel-react-native', () => jest.mock('mixpanel-react-native'));

jest.mock('mixpanel-react-native', () => ({
Mixpanel: MockMixpanel,
}));

class MockReactNativeLDClient {
constructor() {}
init() {}
identify() {}
boolVariation() {}
on() {}
}

const MockAutoEnvAttributes = {
Disabled: 0,
Enabled: 1,
};

jest.mock('@launchdarkly/react-native-client-sdk', () =>
jest.mock('@launchdarkly/react-native-client-sdk'),
);

jest.mock('@launchdarkly/react-native-client-sdk', () => ({
ReactNativeLDClient: MockReactNativeLDClient,
AutoEnvAttributes: MockAutoEnvAttributes,
}));
Loading
Loading