All files / src/apps/sources/__test__ test_data.ts

0% Statements 0/12
100% Branches 0/0
0% Functions 0/1
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93                                                                                                                                                                                         
import { AppState, StatusState } from "../../../redux";
import { APISource, SourceState } from "../types";
import { AuthState } from "../../authentication";
import { DictionaryState } from "../../dictionaries";
import { ConceptsState } from "../../concepts";
import { APIOrganisation, OrganisationState } from "../../organisations";
 
export const testSource: APISource = {
  id: "MSF-SOURCE",
  short_code: "MSF-SRC",
  name: "MSF Source",
  full_name: "MSF Source",
  source_type: "Dictionary",
  public_access: "View",
  default_locale: "en",
  website: "http://msf.org/",
  description:
    "A universal code system for identifying laboratory and clinical observations.",
  extras: { msf_extra_field: "msf_extra_value" },
  url: "/users/root/sources/MSF-SRC/",
  owner: "root",
  owner_type: "User",
  owner_url: "/users/root/",
  external_id: "123",
  supported_locales: ["en", "fr"],
  custom_validation_schema: "Dictionary",
  active_concepts: 2,
  concepts_url: ""
};
 
export const personalSources: SourceState = {
  sources: [{ items: [testSource], responseMeta: { key: false } }],
  versions: [],
  showOnlyVerified: false
};
 
export const orgSources: SourceState = {
  sources: [
    { items: [] },
    { items: [testSource], responseMeta: { key: false } }
  ],
  versions: [],
  showOnlyVerified: false
};
 
export const publicSources: SourceState = {
  sources: [
    { items: [] },
    { items: [] },
    { items: [testSource], responseMeta: { key: false } }
  ],
  versions: [],
  showOnlyVerified: false
};
 
export const organisationState: OrganisationState = {
  organisation: {} as APIOrganisation,
  organisations: [],
  showAddMemberDialog: false,
  showDeleteMemberDialog: undefined,
  showOnlyVerified: false
};
 
const authState: AuthState = { isLoggedIn: true };
 
const statusState: StatusState = { key: [] };
 
const dictionariesState: DictionaryState = {
  dictionaries: [{ items: [] }],
  versions: [],
  addReferencesResults: [],
  showOnlyVerified: true
};
 
const conceptState: ConceptsState = {
  concepts: { items: [], responseMeta: { num_found: 4 } },
  activeConcepts: { items: [], responseMeta: { num_found: 3 } },
  mappings: []
};
 
export const currentState = (sources: SourceState) => {
  const currentState: AppState = {
    auth: authState,
    status: statusState,
    dictionaries: dictionariesState,
    concepts: conceptState,
    sources: sources,
    organisations: organisationState
  };
 
  return currentState;
};