-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat) O3-2882 Create core translations library (#933)
* (feat) O3-2882 Create core translations library * Update mock * yarn * Unrelated: make prettier quieter * Remove @openmrs/esm-app-shell namespace * Fix tests. However, translateFrom (and therefore getCoreTranslations is not working; it always returns the fallback * fixup * Get everything working * Fix fallback and add documentation * Transition all uses of `translateFrom` to use core translations * Ian's fix to use --list-different instead of grep for prettier * Decentralize mocks * Update yarn.lock * Try switching apps to workspace:* dependencies * Fixup * Try switching apps to workspace:* dependencies
- Loading branch information
Showing
70 changed files
with
1,428 additions
and
504 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { of } from 'rxjs'; | ||
import { type SessionStore } from '@openmrs/esm-api'; | ||
import { createGlobalStore } from '@openmrs/esm-state/mock'; | ||
|
||
export const setSessionLocation = jest.fn(() => Promise.resolve()); | ||
export const openmrsFetch = jest.fn((url?: string) => new Promise(() => {})); | ||
export const openmrsObservableFetch = jest.fn(() => of({ data: { entry: [] } })); | ||
export function getCurrentUser() { | ||
return of({ authenticated: false }); | ||
} | ||
export const mockSessionStore = createGlobalStore<SessionStore>('mock-session-store', { | ||
loaded: false, | ||
session: null, | ||
}); | ||
export const getSessionStore = jest.fn(() => mockSessionStore); | ||
export const setCurrentVisit = jest.fn(); | ||
export const newWorkspaceItem = jest.fn(); | ||
export const restBaseURL = '/ws/rest/v1'; | ||
export const fhirBaseUrl = '/ws/fhir2/R4'; | ||
export const attachmentUrl = '/ws/rest/v1/attachment'; | ||
export const getAttachmentByUuid = jest.fn(); | ||
export const getAttachments = jest.fn(); | ||
export const createAttachment = jest.fn(); | ||
export const deleteAttachmentPermanently = jest.fn(); | ||
export const clearCurrentUser = jest.fn(); | ||
export const refetchCurrentUser = jest.fn(); | ||
export const setUserLanguage = jest.fn(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { createGlobalStore } from '@openmrs/esm-state/mock'; | ||
import * as utils from '@openmrs/esm-utils'; | ||
|
||
export { validators, validator } from './src/index'; | ||
|
||
export const configInternalStore = createGlobalStore('config-internal', {}); | ||
|
||
export const implementerToolsConfigStore = createGlobalStore('implementer-tools-config', {}); | ||
|
||
export const temporaryConfigStore = createGlobalStore('temporary-config', {}); | ||
|
||
export enum Type { | ||
Array = 'Array', | ||
Boolean = 'Boolean', | ||
ConceptUuid = 'ConceptUuid', | ||
Number = 'Number', | ||
Object = 'Object', | ||
String = 'String', | ||
UUID = 'UUID', | ||
} | ||
|
||
export let configSchema = {}; | ||
|
||
export const getConfig = jest | ||
.fn() | ||
.mockImplementation(() => Promise.resolve(utils.getDefaultsFromConfigSchema(configSchema))); | ||
|
||
export function defineConfigSchema(moduleName, schema) { | ||
configSchema = schema; | ||
} | ||
|
||
export function defineExtensionConfigSchema(extensionName, schema) { | ||
configSchema = schema; | ||
} | ||
|
||
export const clearConfigErrors = jest.fn(); |
4 changes: 2 additions & 2 deletions
4
packages/framework/esm-config/src/module-config/module-config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { getGlobalStore } from '@openmrs/esm-state/mock'; | ||
|
||
export const attach = jest.fn(); | ||
export const detach = jest.fn(); | ||
export const detachAll = jest.fn(); | ||
|
||
export const switchTo = jest.fn(); | ||
|
||
export const getExtensionStore = () => getGlobalStore('extensions', { slots: {} }); | ||
|
||
export const getExtensionInternalStore = () => | ||
getGlobalStore('extensions-internal', { | ||
slots: {}, | ||
extensions: {}, | ||
}); |
Oops, something went wrong.