Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenwf committed Mar 11, 2022
1 parent c0508cb commit 9470f24
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import { hydrateRevisionStore } from '../../../../src/frontend/shared/capture-models/editor/stores/revisions/revisions-store';
import { registerField } from '../../../../src/frontend/shared/capture-models/plugin-api';
import { registerField } from '../../../../src/frontend/shared/capture-models/plugin-api/global-store';

registerField({
label: 'Text field',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CaptureModel } from '../../../src/frontend/shared/capture-models/types/

describe('current form', () => {
describe('createFormFieldReducer', () => {
const doc: CaptureModel = require('../../../../fixtures/simple.json');
const doc: CaptureModel = require('../../../fixtures/simple.json');
test('simple flat fields', () => {
const reducer = createFormFieldReducer(doc.document);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
mergeFlatKeys,
structureToFlatStructureDefinition,
} from '../../../src/frontend/shared/capture-models/editor/core/structure-editor';
import { expandModelFields } from '../../../src/frontend/shared/capture-models/helpers/expand-model-fields';
import { registerField } from '../../../src/frontend/shared/capture-models/plugin-api/global-store';
import { CaptureModel } from '../../../src/frontend/shared/capture-models/types/capture-model';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const { generateId } = require('../../../src/frontend/shared/capture-models/help
generateId.mockImplementation(() => '[--------GENERATED-ID--------]');

describe('create revision', () => {
const captureModel: CaptureModel = require('../../../../fixtures/03-revisions/06-model-root.json');
const captureModel: CaptureModel = require('../../../fixtures/03-revisions/06-model-root.json');
const [
createFieldA,
editModelA,
Expand Down Expand Up @@ -937,7 +937,7 @@ describe('create revision', () => {
});

describe('Revision with revised field', () => {
const multi = require('../../../../fixtures/03-revisions/05-allow-multiple-transcriptions.json');
const multi = require('../../../fixtures/03-revisions/05-allow-multiple-transcriptions.json');
test('Canonical revision should contain both types and filter out the empty', () => {
const [main] = captureModelToRevisionList(multi, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { filterCaptureModel } from '../../../src/frontend/shared/capture-models/
import { CaptureModel } from '../../../src/frontend/shared/capture-models/types/capture-model';

describe('filterCaptureModel', () => {
const personModel: CaptureModel = require('../../../../fixtures/02-nesting/05-nested-model-multiple.json');
const personModel: CaptureModel = require('../../../fixtures/02-nesting/05-nested-model-multiple.json');
test('non-filter entity maintains structure', () => {
const filtered = filterCaptureModel(
'something',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { filterEmptyStructureFields } from '../../../src/frontend/shared/capture
import { filterEmptyStructures } from '../../../src/frontend/shared/capture-models/helpers/filter-empty-structures';
import { CaptureModel } from '../../../src/frontend/shared/capture-models/types/capture-model';

const filterEmpty = require('../../../../fixtures/06-invalid/01-empty-structure.json');
const filterEmpty = require('../../../fixtures/06-invalid/01-empty-structure.json');

describe('filterEmptyStructures', () => {
test('filterEmptyStructureFields - non-nested', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// eslint-disable-next-line
if (global) { global.globalThis = global; } else { try { globalThis = typeof globalThis !== 'undefined' ? this : globalThis; } catch (e) {} }

import React from 'react';
import * as React from 'react';
import { captureModelToRevisionList } from '../../../src/frontend/shared/capture-models/helpers/capture-model-to-revision-list';
import { hydratePartialDocument } from '../../../src/frontend/shared/capture-models/helpers/hydrate-partial-document';
import { registerField } from '../../../src/frontend/shared/capture-models/plugin-api/global-store';
Expand All @@ -33,7 +33,7 @@ const GENERATED_ID = '[--------GENERATED-ID--------]';
generateId.mockImplementation(() => GENERATED_ID);

describe('hydratePartialDocument', () => {
const captureModel: CaptureModel = require('../../../../fixtures/03-revisions/06-model-root.json');
const captureModel: CaptureModel = require('../../../fixtures/03-revisions/06-model-root.json');
const [
createFieldA,
editModelA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ registerField({
// import { fieldsToInserts } from '../../../database/src/utility/fields-to-inserts';

function getModel() {
return require('../../../../fixtures/02-nesting/06-ocr.json') as CaptureModel;
return require('../../../fixtures/02-nesting/06-ocr.json') as CaptureModel;
}
function getRevisionA() {
return require('../../../../fixtures/98-revision-requests/add-ocr-text.json') as RevisionRequest;
return require('../../../fixtures/98-revision-requests/add-ocr-text.json') as RevisionRequest;
}

describe('OCR Capture model', () => {
Expand Down

0 comments on commit 9470f24

Please sign in to comment.