All files / json-patch/applyPatch/__tests__ testApplyPatch.ts

100% Statements 49/49
100% Branches 1/1
100% Functions 2/2
100% Lines 48/48

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  3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x 3x           3x 4x 4x 4x   4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x     4x 4x     4x 4x     4x 4x 4x      
import type {ApplyPatch} from '../types';
import {testContainsOp} from './ops/contains';
import {testDefinedOp} from './ops/defined';
import {testEndsOp} from './ops/ends';
import {testExtendOp} from './ops/extend';
import {testFlipOp} from './ops/flip';
import {testInOp} from './ops/in';
import {testIncOp} from './ops/inc';
import {testLessOp} from './ops/less';
import {testMatchesOp} from './ops/matches';
import {testMergeOp} from './ops/merge';
import {testMoreOp} from './ops/more';
import {testSplitOp} from './ops/split';
import {testStartsOp} from './ops/starts';
import {testStrDelOp} from './ops/str_del';
import {testStrInsOp} from './ops/str_ins';
import {testTestOp} from './ops/test';
import {testTestString} from './ops/test_string';
import {testTestStrLenOp} from './ops/test_string_len';
import {testTestTypeOp} from './ops/test_type';
import {testTypeOp} from './ops/type';
import {testUndefinedOp} from './ops/undefined';
import {smokeTestApplyPatch} from './smokeTestApplyPatch';
import {testApplyPatchAutomated} from './testApplyPatchAutomated';
 
interface Options {
  dontTestResultHistory?: boolean;
}
 
export const testApplyPatch = (applyPatch: ApplyPatch, options: Options = {}) => {
  smokeTestApplyPatch(applyPatch, options);
  testApplyPatchAutomated(applyPatch);
  describe('applyPatch [by operation]', () => {
    // predicate ops
    testTestOp(applyPatch);
    testStartsOp(applyPatch);
    testEndsOp(applyPatch);
    testContainsOp(applyPatch);
    testDefinedOp(applyPatch);
    testLessOp(applyPatch);
    testMoreOp(applyPatch);
    testMatchesOp(applyPatch);
    testTypeOp(applyPatch);
    testTestStrLenOp(applyPatch);
    testTestTypeOp(applyPatch);
    testInOp(applyPatch);
    testUndefinedOp(applyPatch);
    testTestString(applyPatch);
 
    // string ops
    testStrInsOp(applyPatch);
    testStrDelOp(applyPatch);
 
    // JSON Patch+
    testIncOp(applyPatch);
    testFlipOp(applyPatch);
 
    // Slate.js ops
    testSplitOp(applyPatch);
    testMergeOp(applyPatch);
    testExtendOp(applyPatch);
  });
};