@ -1,5 +1,5 @@
const deepFreeze = require ( 'deep-freeze-strict' ) ;
const deepFreeze = require ( 'deep-freeze-strict' ) ;
const { BuildTypes } = require ( '../utils' ) ;
const { BuildType } = require ( '../utils' ) ;
const {
const {
createRemoveFencedCodeTransform ,
createRemoveFencedCodeTransform ,
removeFencedCode ,
removeFencedCode ,
@ -191,7 +191,7 @@ describe('build/transforms/remove-fenced-code', () => {
const mockFileName = 'file.js' ;
const mockFileName = 'file.js' ;
// Valid inputs
// Valid inputs
Object . keys ( BuildTypes ) . forEach ( ( buildType ) => {
Object . keys ( BuildType ) . forEach ( ( buildType ) => {
it ( ` transforms file with fences for build type " ${ buildType } " ` , ( ) => {
it ( ` transforms file with fences for build type " ${ buildType } " ` , ( ) => {
expect (
expect (
removeFencedCode (
removeFencedCode (
@ -224,7 +224,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect (
expect (
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( 'main' ) ,
getMinimalFencedCode ( 'main' ) ,
) ,
) ,
) . toStrictEqual ( [ '' , true ] ) ;
) . toStrictEqual ( [ '' , true ] ) ;
@ -243,7 +243,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect (
expect (
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( 'main' ) . concat ( ignoredLine ) ,
getMinimalFencedCode ( 'main' ) . concat ( ignoredLine ) ,
) ,
) ,
) . toStrictEqual ( [ ignoredLine , true ] ) ;
) . toStrictEqual ( [ ignoredLine , true ] ) ;
@ -256,7 +256,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect (
expect (
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
modifiedInputWithoutFences ,
modifiedInputWithoutFences ,
) ,
) ,
) . toStrictEqual ( [ modifiedInputWithoutFences , false ] ) ;
) . toStrictEqual ( [ modifiedInputWithoutFences , false ] ) ;
@ -286,7 +286,7 @@ describe('build/transforms/remove-fenced-code', () => {
inputs . forEach ( ( input ) => {
inputs . forEach ( ( input ) => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode ( mockFileName , BuildTypes . flask , input ) ,
removeFencedCode ( mockFileName , BuildType . flask , input ) ,
) . toThrow (
) . toThrow (
` Empty fence found in file " ${ mockFileName } ": \n ${ emptyFence } ` ,
` Empty fence found in file " ${ mockFileName } ": \n ${ emptyFence } ` ,
) ;
) ;
@ -313,7 +313,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( ) . replace (
getMinimalFencedCode ( ) . replace (
fenceSentinelAndTerminusRegex ,
fenceSentinelAndTerminusRegex ,
replacement ,
replacement ,
@ -373,7 +373,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( ) . replace ( directiveString , replacement ) ,
getMinimalFencedCode ( ) . replace ( directiveString , replacement ) ,
) ,
) ,
) . toThrow (
) . toThrow (
@ -419,7 +419,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( ) . replace ( directiveString , replacement ) ,
getMinimalFencedCode ( ) . replace ( directiveString , replacement ) ,
) ,
) ,
) . toThrow (
) . toThrow (
@ -440,7 +440,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( ) . concat ( addition ) ,
getMinimalFencedCode ( ) . concat ( addition ) ,
) ,
) ,
) . toThrow (
) . toThrow (
@ -460,7 +460,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( ) . replace ( validTerminus , replacement ) ,
getMinimalFencedCode ( ) . replace ( validTerminus , replacement ) ,
) ,
) ,
) . toThrow (
) . toThrow (
@ -484,7 +484,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( ) . replace ( validCommand , replacement ) ,
getMinimalFencedCode ( ) . replace ( validCommand , replacement ) ,
) ,
) ,
) . toThrow (
) . toThrow (
@ -513,7 +513,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( replacement ) ,
getMinimalFencedCode ( replacement ) ,
) ,
) ,
) . toThrow (
) . toThrow (
@ -526,7 +526,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
getMinimalFencedCode ( '' ) . replace ( '()' , '' ) ,
getMinimalFencedCode ( '' ) . replace ( '()' , '' ) ,
) ,
) ,
) . toThrow ( /No params specified.$/u ) ;
) . toThrow ( /No params specified.$/u ) ;
@ -562,7 +562,7 @@ describe('build/transforms/remove-fenced-code', () => {
expect ( ( ) =>
expect ( ( ) =>
removeFencedCode (
removeFencedCode (
mockFileName ,
mockFileName ,
BuildTypes . flask ,
BuildType . flask ,
input . replace ( target , replacement ) ,
input . replace ( target , replacement ) ,
) ,
) ,
) . toThrow ( expectedError ) ;
) . toThrow ( expectedError ) ;