Skip to content

Commit

Permalink
Prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
ariskataoka committed Jul 18, 2024
1 parent 835156e commit e5f3219
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
22 changes: 11 additions & 11 deletions __tests__/lib/vip-import-validate-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import chalk from 'chalk';
import fs from 'fs';

import {
folderStructureValidation,
directoryStructureValidation,
isFileSanitized,
validateFiles,
logErrors,
Expand All @@ -12,9 +12,9 @@ import {
global.console = { log: jest.fn(), error: jest.fn() };

describe( 'lib/vip-import-validate-files', () => {
describe( 'folderStructureValidation', () => {
it( 'should correctly validate a recommended folder structure', async () => {
const folderStructureObj = {
describe( 'directoryStructureValidation', () => {
it( 'should correctly validate a recommended directory structure', async () => {
const directoryStructureObj = {
'uploads/2020/06': true,
'uploads/2019/01': true,
'uploads/2018/03': true,
Expand All @@ -24,20 +24,20 @@ describe( 'lib/vip-import-validate-files', () => {
jest.spyOn( global.console, 'log' );

// Call function
folderStructureValidation( Object.keys( folderStructureObj ) );
directoryStructureValidation( Object.keys( directoryStructureObj ) );

expect( console.log ).toHaveBeenCalled();
expect( console.log.mock.calls[ 0 ][ 0 ] ).toEqual( expect.stringContaining( 'Folder:' ) );
expect( console.log.mock.calls[ 0 ][ 0 ] ).toEqual( expect.stringContaining( 'Directory:' ) );
expect( console.log.mock.calls[ 0 ][ 1 ] ).toEqual(
expect.stringContaining( 'uploads/2020/06' )
);
} );
it( 'should log recommendations for a non-recommended folder structure', async () => {
const path = 'folder/structure/not-recommended';
it( 'should log recommendations for a non-recommended directory structure', async () => {
const path = 'directory/structure/not-recommended';

jest.spyOn( global.console, 'log' );

folderStructureValidation( path );
directoryStructureValidation( path );

expect( console.log ).toHaveBeenCalled();
} );
Expand Down Expand Up @@ -257,7 +257,7 @@ describe( 'lib/vip-import-validate-files', () => {

const result = findNestedDirectories( '/empty/dir' );

expect( result ).toEqual( { files: [], folderStructureObj: {} } );
expect( result ).toEqual( { files: [], directoryStructureObj: {} } );
} );

it( 'should filter out hidden files', () => {
Expand All @@ -268,7 +268,7 @@ describe( 'lib/vip-import-validate-files', () => {

expect( result ).toEqual( {
files: [ '/dir/with/hidden/files/file1.txt', '/dir/with/hidden/files/file2.txt' ],
folderStructureObj: { '/dir/with/hidden/files': true },
directoryStructureObj: { '/dir/with/hidden/files': true },
} );
} );
} );
Expand Down
1 change: 0 additions & 1 deletion src/lib/vip-import-validate-files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -601,7 +601,6 @@ const multiSiteValidation = ( directoryPath: string ): string | null => {
return null;
};


/**
* Directory structure validation
*
Expand Down

0 comments on commit e5f3219

Please sign in to comment.