From 6b200732357c2a4d6e1fc4d52e5d7f5b440c6294 Mon Sep 17 00:00:00 2001 From: guido Date: Mon, 15 Jan 2024 23:35:11 +0100 Subject: [PATCH] Update source directories --- composer.json | 2 +- jest.config.ts | 2 +- package.json | 8 ++++---- phpcs.xml | 2 +- sources/{js => client}/src/api/fetch.ts | 0 sources/{js => client}/src/api/search-entities.ts | 0 .../src/components/composite-entities-by-kind.tsx | 0 .../{js => client}/src/components/no-options-message.tsx | 0 .../src/components/plural-select-control.tsx | 0 sources/{js => client}/src/components/radio-control.tsx | 0 sources/{js => client}/src/components/search-control.tsx | 0 .../src/components/singular-select-control.tsx | 0 sources/{js => client}/src/components/toggle-control.tsx | 0 .../src/hooks/use-entities-options-storage.ts | 0 sources/{js => client}/src/hooks/use-entity-records.ts | 0 .../src/hooks/use-query-viewable-post-types.ts | 0 .../src/hooks/use-query-viewable-taxonomies.ts | 0 sources/{js => client}/src/index.ts | 0 .../{js => client}/src/storage/entities/initial-state.ts | 0 sources/{js => client}/src/storage/entities/reducer.ts | 0 .../src/utils/convert-entities-to-control-options.ts | 0 sources/{js => client}/src/utils/is-control-option.ts | 0 sources/{js => client}/src/utils/make-control-option.ts | 0 .../src/utils/order-selected-options-at-the-top.ts | 0 .../{js => client}/src/utils/unique-control-options.ts | 0 sources/{php => server}/src/Library.php | 0 .../{php => server}/src/Modules/BlockEditor/Module.php | 0 sources/{php => server}/src/Modules/E2e/Module.php | 4 ++-- .../E2e/resources/js/post-types-example-block/block.json | 0 .../E2e/resources/js/post-types-example-block/index.js | 0 .../E2e/resources/js/taxonomies-example-block/block.json | 0 .../E2e/resources/js/taxonomies-example-block/index.js | 0 .../components/composite-entities-by-kind.test.tsx | 8 ++++---- tests/{js => client}/setup-tests.ts | 0 tests/{js => client}/unit/api/search-entities.test.ts | 6 +++--- .../__snapshots__/entities-toggle-control.test.tsx.snap | 0 .../components/__snapshots__/radio-control.test.tsx.snap | 0 .../components/__snapshots__/search-control.test.tsx.snap | 0 .../unit/components/entities-toggle-control.test.tsx | 2 +- .../unit/components/plural-select-control.test.tsx | 2 +- .../{js => client}/unit/components/radio-control.test.tsx | 2 +- .../unit/components/search-control.test.tsx | 2 +- .../unit/components/singular-select-control.test.tsx | 2 +- .../unit/hooks/use-entities-options-storage.test.ts | 2 +- .../{js => client}/unit/hooks/use-entity-records.test.ts | 2 +- .../unit/hooks/use-query-viewable-post-types.test.ts | 6 +++--- .../unit/hooks/use-query-viewable-taxonomies.test.ts | 6 +++--- tests/{js => client}/unit/storage/initial-state.test.ts | 2 +- tests/{js => client}/unit/storage/reducer.test.ts | 2 +- tests/{js => client}/unit/utils.ts | 0 .../utils/convert-entities-to-control-options.test.ts | 2 +- tests/{js => client}/unit/utils/is-control-option.test.ts | 2 +- .../{js => client}/unit/utils/make-control-option.test.ts | 2 +- .../utils/ordered-selected-options-at-the-top.test.ts | 2 +- .../unit/utils/unique-control-options.test.ts | 2 +- tsconfig.json | 2 +- webpack.config.js | 2 +- 57 files changed, 38 insertions(+), 38 deletions(-) rename sources/{js => client}/src/api/fetch.ts (100%) rename sources/{js => client}/src/api/search-entities.ts (100%) rename sources/{js => client}/src/components/composite-entities-by-kind.tsx (100%) rename sources/{js => client}/src/components/no-options-message.tsx (100%) rename sources/{js => client}/src/components/plural-select-control.tsx (100%) rename sources/{js => client}/src/components/radio-control.tsx (100%) rename sources/{js => client}/src/components/search-control.tsx (100%) rename sources/{js => client}/src/components/singular-select-control.tsx (100%) rename sources/{js => client}/src/components/toggle-control.tsx (100%) rename sources/{js => client}/src/hooks/use-entities-options-storage.ts (100%) rename sources/{js => client}/src/hooks/use-entity-records.ts (100%) rename sources/{js => client}/src/hooks/use-query-viewable-post-types.ts (100%) rename sources/{js => client}/src/hooks/use-query-viewable-taxonomies.ts (100%) rename sources/{js => client}/src/index.ts (100%) rename sources/{js => client}/src/storage/entities/initial-state.ts (100%) rename sources/{js => client}/src/storage/entities/reducer.ts (100%) rename sources/{js => client}/src/utils/convert-entities-to-control-options.ts (100%) rename sources/{js => client}/src/utils/is-control-option.ts (100%) rename sources/{js => client}/src/utils/make-control-option.ts (100%) rename sources/{js => client}/src/utils/order-selected-options-at-the-top.ts (100%) rename sources/{js => client}/src/utils/unique-control-options.ts (100%) rename sources/{php => server}/src/Library.php (100%) rename sources/{php => server}/src/Modules/BlockEditor/Module.php (100%) rename sources/{php => server}/src/Modules/E2e/Module.php (94%) rename sources/{php => server}/src/Modules/E2e/resources/js/post-types-example-block/block.json (100%) rename sources/{php => server}/src/Modules/E2e/resources/js/post-types-example-block/index.js (100%) rename sources/{php => server}/src/Modules/E2e/resources/js/taxonomies-example-block/block.json (100%) rename sources/{php => server}/src/Modules/E2e/resources/js/taxonomies-example-block/index.js (100%) rename tests/{js => client}/integration/components/composite-entities-by-kind.test.tsx (96%) rename tests/{js => client}/setup-tests.ts (100%) rename tests/{js => client}/unit/api/search-entities.test.ts (86%) rename tests/{js => client}/unit/components/__snapshots__/entities-toggle-control.test.tsx.snap (100%) rename tests/{js => client}/unit/components/__snapshots__/radio-control.test.tsx.snap (100%) rename tests/{js => client}/unit/components/__snapshots__/search-control.test.tsx.snap (100%) rename tests/{js => client}/unit/components/entities-toggle-control.test.tsx (94%) rename tests/{js => client}/unit/components/plural-select-control.test.tsx (93%) rename tests/{js => client}/unit/components/radio-control.test.tsx (95%) rename tests/{js => client}/unit/components/search-control.test.tsx (94%) rename tests/{js => client}/unit/components/singular-select-control.test.tsx (92%) rename tests/{js => client}/unit/hooks/use-entities-options-storage.test.ts (82%) rename tests/{js => client}/unit/hooks/use-entity-records.test.ts (97%) rename tests/{js => client}/unit/hooks/use-query-viewable-post-types.test.ts (83%) rename tests/{js => client}/unit/hooks/use-query-viewable-taxonomies.test.ts (85%) rename tests/{js => client}/unit/storage/initial-state.test.ts (78%) rename tests/{js => client}/unit/storage/reducer.test.ts (95%) rename tests/{js => client}/unit/utils.ts (100%) rename tests/{js => client}/unit/utils/convert-entities-to-control-options.test.ts (96%) rename tests/{js => client}/unit/utils/is-control-option.test.ts (85%) rename tests/{js => client}/unit/utils/make-control-option.test.ts (80%) rename tests/{js => client}/unit/utils/ordered-selected-options-at-the-top.test.ts (97%) rename tests/{js => client}/unit/utils/unique-control-options.test.ts (87%) diff --git a/composer.json b/composer.json index f9aa010..de802a0 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "version": "1.0.0", "autoload": { "psr-4": { - "Widoz\\EntitiesSearch\\": "sources/php/src/" + "Widoz\\EntitiesSearch\\": "sources/server/src/" } }, "authors": [ diff --git a/jest.config.ts b/jest.config.ts index 8cb3fc7..eecf311 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -3,5 +3,5 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'jsdom', moduleDirectories: ['node_modules'], - setupFilesAfterEnv: ['/tests/js/setup-tests.ts'], + setupFilesAfterEnv: ['/tests/client/setup-tests.ts'], }; diff --git a/package.json b/package.json index 9ead7c4..d5db88d 100644 --- a/package.json +++ b/package.json @@ -43,10 +43,10 @@ }, "scripts": { "wp-env": "wp-env", - "build": "wp-scripts build --webpack-src-dir=./sources/js/src", - "build:dev": "wp-scripts start --webpack--devtool=inline-source-map --webpack-src-dir=./sources/js/src", - "cs": "yarn prettier --check ./sources/js", - "cs:fix": "wp-scripts format ./sources/js", + "build": "wp-scripts build --webpack-src-dir=./sources/client/src", + "build:dev": "wp-scripts start --webpack--devtool=inline-source-map --webpack-src-dir=./sources/client/src", + "cs": "yarn prettier --check ./sources/client", + "cs:fix": "wp-scripts format ./sources/client", "lint:js": "wp-scripts lint-js", "lint:js:fix": "wp-scripts lint-js --fix", "test": "jest" diff --git a/phpcs.xml b/phpcs.xml index f490dfd..c4b58cb 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -1,6 +1,6 @@ - ./sources/php/ + ./sources/server/ diff --git a/sources/js/src/api/fetch.ts b/sources/client/src/api/fetch.ts similarity index 100% rename from sources/js/src/api/fetch.ts rename to sources/client/src/api/fetch.ts diff --git a/sources/js/src/api/search-entities.ts b/sources/client/src/api/search-entities.ts similarity index 100% rename from sources/js/src/api/search-entities.ts rename to sources/client/src/api/search-entities.ts diff --git a/sources/js/src/components/composite-entities-by-kind.tsx b/sources/client/src/components/composite-entities-by-kind.tsx similarity index 100% rename from sources/js/src/components/composite-entities-by-kind.tsx rename to sources/client/src/components/composite-entities-by-kind.tsx diff --git a/sources/js/src/components/no-options-message.tsx b/sources/client/src/components/no-options-message.tsx similarity index 100% rename from sources/js/src/components/no-options-message.tsx rename to sources/client/src/components/no-options-message.tsx diff --git a/sources/js/src/components/plural-select-control.tsx b/sources/client/src/components/plural-select-control.tsx similarity index 100% rename from sources/js/src/components/plural-select-control.tsx rename to sources/client/src/components/plural-select-control.tsx diff --git a/sources/js/src/components/radio-control.tsx b/sources/client/src/components/radio-control.tsx similarity index 100% rename from sources/js/src/components/radio-control.tsx rename to sources/client/src/components/radio-control.tsx diff --git a/sources/js/src/components/search-control.tsx b/sources/client/src/components/search-control.tsx similarity index 100% rename from sources/js/src/components/search-control.tsx rename to sources/client/src/components/search-control.tsx diff --git a/sources/js/src/components/singular-select-control.tsx b/sources/client/src/components/singular-select-control.tsx similarity index 100% rename from sources/js/src/components/singular-select-control.tsx rename to sources/client/src/components/singular-select-control.tsx diff --git a/sources/js/src/components/toggle-control.tsx b/sources/client/src/components/toggle-control.tsx similarity index 100% rename from sources/js/src/components/toggle-control.tsx rename to sources/client/src/components/toggle-control.tsx diff --git a/sources/js/src/hooks/use-entities-options-storage.ts b/sources/client/src/hooks/use-entities-options-storage.ts similarity index 100% rename from sources/js/src/hooks/use-entities-options-storage.ts rename to sources/client/src/hooks/use-entities-options-storage.ts diff --git a/sources/js/src/hooks/use-entity-records.ts b/sources/client/src/hooks/use-entity-records.ts similarity index 100% rename from sources/js/src/hooks/use-entity-records.ts rename to sources/client/src/hooks/use-entity-records.ts diff --git a/sources/js/src/hooks/use-query-viewable-post-types.ts b/sources/client/src/hooks/use-query-viewable-post-types.ts similarity index 100% rename from sources/js/src/hooks/use-query-viewable-post-types.ts rename to sources/client/src/hooks/use-query-viewable-post-types.ts diff --git a/sources/js/src/hooks/use-query-viewable-taxonomies.ts b/sources/client/src/hooks/use-query-viewable-taxonomies.ts similarity index 100% rename from sources/js/src/hooks/use-query-viewable-taxonomies.ts rename to sources/client/src/hooks/use-query-viewable-taxonomies.ts diff --git a/sources/js/src/index.ts b/sources/client/src/index.ts similarity index 100% rename from sources/js/src/index.ts rename to sources/client/src/index.ts diff --git a/sources/js/src/storage/entities/initial-state.ts b/sources/client/src/storage/entities/initial-state.ts similarity index 100% rename from sources/js/src/storage/entities/initial-state.ts rename to sources/client/src/storage/entities/initial-state.ts diff --git a/sources/js/src/storage/entities/reducer.ts b/sources/client/src/storage/entities/reducer.ts similarity index 100% rename from sources/js/src/storage/entities/reducer.ts rename to sources/client/src/storage/entities/reducer.ts diff --git a/sources/js/src/utils/convert-entities-to-control-options.ts b/sources/client/src/utils/convert-entities-to-control-options.ts similarity index 100% rename from sources/js/src/utils/convert-entities-to-control-options.ts rename to sources/client/src/utils/convert-entities-to-control-options.ts diff --git a/sources/js/src/utils/is-control-option.ts b/sources/client/src/utils/is-control-option.ts similarity index 100% rename from sources/js/src/utils/is-control-option.ts rename to sources/client/src/utils/is-control-option.ts diff --git a/sources/js/src/utils/make-control-option.ts b/sources/client/src/utils/make-control-option.ts similarity index 100% rename from sources/js/src/utils/make-control-option.ts rename to sources/client/src/utils/make-control-option.ts diff --git a/sources/js/src/utils/order-selected-options-at-the-top.ts b/sources/client/src/utils/order-selected-options-at-the-top.ts similarity index 100% rename from sources/js/src/utils/order-selected-options-at-the-top.ts rename to sources/client/src/utils/order-selected-options-at-the-top.ts diff --git a/sources/js/src/utils/unique-control-options.ts b/sources/client/src/utils/unique-control-options.ts similarity index 100% rename from sources/js/src/utils/unique-control-options.ts rename to sources/client/src/utils/unique-control-options.ts diff --git a/sources/php/src/Library.php b/sources/server/src/Library.php similarity index 100% rename from sources/php/src/Library.php rename to sources/server/src/Library.php diff --git a/sources/php/src/Modules/BlockEditor/Module.php b/sources/server/src/Modules/BlockEditor/Module.php similarity index 100% rename from sources/php/src/Modules/BlockEditor/Module.php rename to sources/server/src/Modules/BlockEditor/Module.php diff --git a/sources/php/src/Modules/E2e/Module.php b/sources/server/src/Modules/E2e/Module.php similarity index 94% rename from sources/php/src/Modules/E2e/Module.php rename to sources/server/src/Modules/E2e/Module.php index e871df0..36cbac6 100644 --- a/sources/php/src/Modules/E2e/Module.php +++ b/sources/server/src/Modules/E2e/Module.php @@ -90,7 +90,7 @@ private static function postTypesExample(Modularity\Properties\Properties $prope \wp_register_script( 'widoz-entities-search-e2e-post-types-example-block', - "{$baseUrl}/sources/php/src/Modules/E2e/resources/js/post-types-example-block/index.js", + "{$baseUrl}/sources/server/src/Modules/E2e/resources/js/post-types-example-block/index.js", ['widoz-entities-search', 'immutable'], '0.0.0', true, @@ -98,7 +98,7 @@ private static function postTypesExample(Modularity\Properties\Properties $prope \wp_register_script( 'widoz-entities-search-e2e-taxonomies-example-block', - "{$baseUrl}/sources/php/src/Modules/E2e/resources/js/taxonomies-example-block/index.js", + "{$baseUrl}/sources/server/src/Modules/E2e/resources/js/taxonomies-example-block/index.js", ['widoz-entities-search', 'immutable'], '0.0.0', true, diff --git a/sources/php/src/Modules/E2e/resources/js/post-types-example-block/block.json b/sources/server/src/Modules/E2e/resources/js/post-types-example-block/block.json similarity index 100% rename from sources/php/src/Modules/E2e/resources/js/post-types-example-block/block.json rename to sources/server/src/Modules/E2e/resources/js/post-types-example-block/block.json diff --git a/sources/php/src/Modules/E2e/resources/js/post-types-example-block/index.js b/sources/server/src/Modules/E2e/resources/js/post-types-example-block/index.js similarity index 100% rename from sources/php/src/Modules/E2e/resources/js/post-types-example-block/index.js rename to sources/server/src/Modules/E2e/resources/js/post-types-example-block/index.js diff --git a/sources/php/src/Modules/E2e/resources/js/taxonomies-example-block/block.json b/sources/server/src/Modules/E2e/resources/js/taxonomies-example-block/block.json similarity index 100% rename from sources/php/src/Modules/E2e/resources/js/taxonomies-example-block/block.json rename to sources/server/src/Modules/E2e/resources/js/taxonomies-example-block/block.json diff --git a/sources/php/src/Modules/E2e/resources/js/taxonomies-example-block/index.js b/sources/server/src/Modules/E2e/resources/js/taxonomies-example-block/index.js similarity index 100% rename from sources/php/src/Modules/E2e/resources/js/taxonomies-example-block/index.js rename to sources/server/src/Modules/E2e/resources/js/taxonomies-example-block/index.js diff --git a/tests/js/integration/components/composite-entities-by-kind.test.tsx b/tests/client/integration/components/composite-entities-by-kind.test.tsx similarity index 96% rename from tests/js/integration/components/composite-entities-by-kind.test.tsx rename to tests/client/integration/components/composite-entities-by-kind.test.tsx index 0840000..9cf8a49 100644 --- a/tests/js/integration/components/composite-entities-by-kind.test.tsx +++ b/tests/client/integration/components/composite-entities-by-kind.test.tsx @@ -7,10 +7,10 @@ import { describe, it, expect, beforeAll, jest } from '@jest/globals'; import { render, act } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { CompositeEntitiesByKind } from '../../../../sources/js/src/components/composite-entities-by-kind'; -import { PluralSelectControl } from '../../../../sources/js/src/components/plural-select-control'; -import { SearchControl } from '../../../../sources/js/src/components/search-control'; -import { SingularSelectControl } from '../../../../sources/js/src/components/singular-select-control'; +import { CompositeEntitiesByKind } from '../../../../sources/client/src/components/composite-entities-by-kind'; +import { PluralSelectControl } from '../../../../sources/client/src/components/plural-select-control'; +import { SearchControl } from '../../../../sources/client/src/components/search-control'; +import { SingularSelectControl } from '../../../../sources/client/src/components/singular-select-control'; describe('CompositeEntitiesByKind', () => { beforeAll(() => { diff --git a/tests/js/setup-tests.ts b/tests/client/setup-tests.ts similarity index 100% rename from tests/js/setup-tests.ts rename to tests/client/setup-tests.ts diff --git a/tests/js/unit/api/search-entities.test.ts b/tests/client/unit/api/search-entities.test.ts similarity index 86% rename from tests/js/unit/api/search-entities.test.ts rename to tests/client/unit/api/search-entities.test.ts index f6ece12..e3b865b 100644 --- a/tests/js/unit/api/search-entities.test.ts +++ b/tests/client/unit/api/search-entities.test.ts @@ -3,10 +3,10 @@ import { OrderedSet } from 'immutable'; import { describe, expect, it, jest } from '@jest/globals'; -import { fetch } from '../../../../sources/js/src/api/fetch'; -import { searchEntities } from '../../../../sources/js/src/api/search-entities'; +import { fetch } from '../../../../sources/client/src/api/fetch'; +import { searchEntities } from '../../../../sources/client/src/api/search-entities'; -jest.mock('../../../../sources/js/src/api/fetch', () => ({ +jest.mock('../../../../sources/client/src/api/fetch', () => ({ fetch: jest.fn(), })); diff --git a/tests/js/unit/components/__snapshots__/entities-toggle-control.test.tsx.snap b/tests/client/unit/components/__snapshots__/entities-toggle-control.test.tsx.snap similarity index 100% rename from tests/js/unit/components/__snapshots__/entities-toggle-control.test.tsx.snap rename to tests/client/unit/components/__snapshots__/entities-toggle-control.test.tsx.snap diff --git a/tests/js/unit/components/__snapshots__/radio-control.test.tsx.snap b/tests/client/unit/components/__snapshots__/radio-control.test.tsx.snap similarity index 100% rename from tests/js/unit/components/__snapshots__/radio-control.test.tsx.snap rename to tests/client/unit/components/__snapshots__/radio-control.test.tsx.snap diff --git a/tests/js/unit/components/__snapshots__/search-control.test.tsx.snap b/tests/client/unit/components/__snapshots__/search-control.test.tsx.snap similarity index 100% rename from tests/js/unit/components/__snapshots__/search-control.test.tsx.snap rename to tests/client/unit/components/__snapshots__/search-control.test.tsx.snap diff --git a/tests/js/unit/components/entities-toggle-control.test.tsx b/tests/client/unit/components/entities-toggle-control.test.tsx similarity index 94% rename from tests/js/unit/components/entities-toggle-control.test.tsx rename to tests/client/unit/components/entities-toggle-control.test.tsx index 4ddcba1..c3a9a7a 100644 --- a/tests/js/unit/components/entities-toggle-control.test.tsx +++ b/tests/client/unit/components/entities-toggle-control.test.tsx @@ -5,7 +5,7 @@ import { describe, expect, it, jest } from '@jest/globals'; import { render, screen, fireEvent } from '@testing-library/react'; -import { ToggleControl } from '../../../../sources/js/src/components/toggle-control'; +import { ToggleControl } from '../../../../sources/client/src/components/toggle-control'; const options = OrderedSet([ { label: 'Option 1', value: '1' }, diff --git a/tests/js/unit/components/plural-select-control.test.tsx b/tests/client/unit/components/plural-select-control.test.tsx similarity index 93% rename from tests/js/unit/components/plural-select-control.test.tsx rename to tests/client/unit/components/plural-select-control.test.tsx index 945a6fc..36923c1 100644 --- a/tests/js/unit/components/plural-select-control.test.tsx +++ b/tests/client/unit/components/plural-select-control.test.tsx @@ -9,7 +9,7 @@ import userEvent from '@testing-library/user-event'; import { faker } from '@faker-js/faker'; -import { PluralSelectControl } from '../../../../sources/js/src/components/plural-select-control'; +import { PluralSelectControl } from '../../../../sources/client/src/components/plural-select-control'; import { buildOptions } from '../utils'; describe('Posts Select', () => { diff --git a/tests/js/unit/components/radio-control.test.tsx b/tests/client/unit/components/radio-control.test.tsx similarity index 95% rename from tests/js/unit/components/radio-control.test.tsx rename to tests/client/unit/components/radio-control.test.tsx index fac773b..39a2595 100644 --- a/tests/js/unit/components/radio-control.test.tsx +++ b/tests/client/unit/components/radio-control.test.tsx @@ -9,7 +9,7 @@ import { expect, jest, describe, it } from '@jest/globals'; import { render, screen, fireEvent } from '@testing-library/react'; -import { RadioControl } from '../../../../sources/js/src/components/radio-control'; +import { RadioControl } from '../../../../sources/client/src/components/radio-control'; describe('KindRadioControl', () => { it('renders the component', () => { diff --git a/tests/js/unit/components/search-control.test.tsx b/tests/client/unit/components/search-control.test.tsx similarity index 94% rename from tests/js/unit/components/search-control.test.tsx rename to tests/client/unit/components/search-control.test.tsx index bd050e3..afc7b70 100644 --- a/tests/js/unit/components/search-control.test.tsx +++ b/tests/client/unit/components/search-control.test.tsx @@ -10,7 +10,7 @@ import { describe, it, expect, jest } from '@jest/globals'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import { SearchControl } from '../../../../sources/js/src/components/search-control'; +import { SearchControl } from '../../../../sources/client/src/components/search-control'; jest.mock('@wordpress/i18n', () => ({ __: (text: string) => text, diff --git a/tests/js/unit/components/singular-select-control.test.tsx b/tests/client/unit/components/singular-select-control.test.tsx similarity index 92% rename from tests/js/unit/components/singular-select-control.test.tsx rename to tests/client/unit/components/singular-select-control.test.tsx index d0812b7..3f17ed7 100644 --- a/tests/js/unit/components/singular-select-control.test.tsx +++ b/tests/client/unit/components/singular-select-control.test.tsx @@ -9,7 +9,7 @@ import userEvent from '@testing-library/user-event'; import { faker } from '@faker-js/faker'; -import { SingularSelectControl } from '../../../../sources/js/src/components/singular-select-control'; +import { SingularSelectControl } from '../../../../sources/client/src/components/singular-select-control'; import { buildOptions } from '../utils'; describe('Post Types Select', () => { diff --git a/tests/js/unit/hooks/use-entities-options-storage.test.ts b/tests/client/unit/hooks/use-entities-options-storage.test.ts similarity index 82% rename from tests/js/unit/hooks/use-entities-options-storage.test.ts rename to tests/client/unit/hooks/use-entities-options-storage.test.ts index e9d62b3..5414838 100644 --- a/tests/js/unit/hooks/use-entities-options-storage.test.ts +++ b/tests/client/unit/hooks/use-entities-options-storage.test.ts @@ -2,7 +2,7 @@ import { describe, expect, it } from '@jest/globals'; import { renderHook } from '@testing-library/react'; -import { useEntitiesOptionsStorage } from '../../../../sources/js/src/hooks/use-entities-options-storage'; +import { useEntitiesOptionsStorage } from '../../../../sources/client/src/hooks/use-entities-options-storage'; describe('Use Posts Options Storage', () => { it('returns always the same state and dispatcher', () => { diff --git a/tests/js/unit/hooks/use-entity-records.test.ts b/tests/client/unit/hooks/use-entity-records.test.ts similarity index 97% rename from tests/js/unit/hooks/use-entity-records.test.ts rename to tests/client/unit/hooks/use-entity-records.test.ts index 997c2fd..53a9d2b 100644 --- a/tests/js/unit/hooks/use-entity-records.test.ts +++ b/tests/client/unit/hooks/use-entity-records.test.ts @@ -5,7 +5,7 @@ import { describe, it, jest, expect } from '@jest/globals'; import { useEntityRecords as useCoreEntityRecords } from '@wordpress/core-data'; -import { useEntityRecords } from '../../../../sources/js/src'; +import { useEntityRecords } from '../../../../sources/client/src'; jest.mock('@wordpress/core-data', () => ({ useEntityRecords: jest.fn(), diff --git a/tests/js/unit/hooks/use-query-viewable-post-types.test.ts b/tests/client/unit/hooks/use-query-viewable-post-types.test.ts similarity index 83% rename from tests/js/unit/hooks/use-query-viewable-post-types.test.ts rename to tests/client/unit/hooks/use-query-viewable-post-types.test.ts index 6320b11..51fd2c4 100644 --- a/tests/js/unit/hooks/use-query-viewable-post-types.test.ts +++ b/tests/client/unit/hooks/use-query-viewable-post-types.test.ts @@ -4,15 +4,15 @@ import { OrderedSet } from 'immutable'; import { describe, it, jest, expect } from '@jest/globals'; -import { useEntityRecords } from '../../../../sources/js/src/hooks/use-entity-records'; -import { useQueryViewablePostTypes } from '../../../../sources/js/src/hooks/use-query-viewable-post-types'; +import { useEntityRecords } from '../../../../sources/client/src/hooks/use-entity-records'; +import { useQueryViewablePostTypes } from '../../../../sources/client/src/hooks/use-query-viewable-post-types'; jest.mock('@wordpress/data', () => { return { useSelect: jest.fn(), }; }); -jest.mock('../../../../sources/js/src/hooks/use-entity-records', () => { +jest.mock('../../../../sources/client/src/hooks/use-entity-records', () => { return { useEntityRecords: jest.fn(), }; diff --git a/tests/js/unit/hooks/use-query-viewable-taxonomies.test.ts b/tests/client/unit/hooks/use-query-viewable-taxonomies.test.ts similarity index 85% rename from tests/js/unit/hooks/use-query-viewable-taxonomies.test.ts rename to tests/client/unit/hooks/use-query-viewable-taxonomies.test.ts index 7b110a9..eb4e8df 100644 --- a/tests/js/unit/hooks/use-query-viewable-taxonomies.test.ts +++ b/tests/client/unit/hooks/use-query-viewable-taxonomies.test.ts @@ -4,10 +4,10 @@ import { OrderedSet } from 'immutable'; import { describe, expect, it, jest } from '@jest/globals'; -import { useEntityRecords } from '../../../../sources/js/src/hooks/use-entity-records'; -import { useQueryViewableTaxonomies } from '../../../../sources/js/src/hooks/use-query-viewable-taxonomies'; +import { useEntityRecords } from '../../../../sources/client/src/hooks/use-entity-records'; +import { useQueryViewableTaxonomies } from '../../../../sources/client/src/hooks/use-query-viewable-taxonomies'; -jest.mock('../../../../sources/js/src/hooks/use-entity-records', () => { +jest.mock('../../../../sources/client/src/hooks/use-entity-records', () => { return { useEntityRecords: jest.fn(), }; diff --git a/tests/js/unit/storage/initial-state.test.ts b/tests/client/unit/storage/initial-state.test.ts similarity index 78% rename from tests/js/unit/storage/initial-state.test.ts rename to tests/client/unit/storage/initial-state.test.ts index edcc0dc..e68d7f7 100644 --- a/tests/js/unit/storage/initial-state.test.ts +++ b/tests/client/unit/storage/initial-state.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from '@jest/globals'; -import { makeInitialState } from '../../../../sources/js/src/storage/entities/initial-state'; +import { makeInitialState } from '../../../../sources/client/src/storage/entities/initial-state'; describe('Initial state', () => { it('ensure all options are empty', () => { diff --git a/tests/js/unit/storage/reducer.test.ts b/tests/client/unit/storage/reducer.test.ts similarity index 95% rename from tests/js/unit/storage/reducer.test.ts rename to tests/client/unit/storage/reducer.test.ts index 5becfdc..dc3063d 100644 --- a/tests/js/unit/storage/reducer.test.ts +++ b/tests/client/unit/storage/reducer.test.ts @@ -5,7 +5,7 @@ import { beforeEach, describe, expect, it } from '@jest/globals'; import { faker } from '@faker-js/faker'; -import { reducer } from '../../../../sources/js/src/storage/entities/reducer'; +import { reducer } from '../../../../sources/client/src/storage/entities/reducer'; let state: EntitiesSearch.EntitiesState; diff --git a/tests/js/unit/utils.ts b/tests/client/unit/utils.ts similarity index 100% rename from tests/js/unit/utils.ts rename to tests/client/unit/utils.ts diff --git a/tests/js/unit/utils/convert-entities-to-control-options.test.ts b/tests/client/unit/utils/convert-entities-to-control-options.test.ts similarity index 96% rename from tests/js/unit/utils/convert-entities-to-control-options.test.ts rename to tests/client/unit/utils/convert-entities-to-control-options.test.ts index 1ae0003..dd0b1dd 100644 --- a/tests/js/unit/utils/convert-entities-to-control-options.test.ts +++ b/tests/client/unit/utils/convert-entities-to-control-options.test.ts @@ -6,7 +6,7 @@ import { describe, expect, it } from '@jest/globals'; import { faker } from '@faker-js/faker'; -import { convertEntitiesToControlOptions } from '../../../../sources/js/src/utils/convert-entities-to-control-options'; +import { convertEntitiesToControlOptions } from '../../../../sources/client/src/utils/convert-entities-to-control-options'; describe('Convert Entities To Control Options', () => { it('correctly convert entities to control options', () => { diff --git a/tests/js/unit/utils/is-control-option.test.ts b/tests/client/unit/utils/is-control-option.test.ts similarity index 85% rename from tests/js/unit/utils/is-control-option.test.ts rename to tests/client/unit/utils/is-control-option.test.ts index ca6f69e..dccf81b 100644 --- a/tests/js/unit/utils/is-control-option.test.ts +++ b/tests/client/unit/utils/is-control-option.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from '@jest/globals'; -import { isControlOption } from '../../../../sources/js/src/utils/is-control-option'; +import { isControlOption } from '../../../../sources/client/src/utils/is-control-option'; describe('isControlOption', () => { it('shall return true when given object is of type of ControlOption', () => { diff --git a/tests/js/unit/utils/make-control-option.test.ts b/tests/client/unit/utils/make-control-option.test.ts similarity index 80% rename from tests/js/unit/utils/make-control-option.test.ts rename to tests/client/unit/utils/make-control-option.test.ts index c208db4..5df9c69 100644 --- a/tests/js/unit/utils/make-control-option.test.ts +++ b/tests/client/unit/utils/make-control-option.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from '@jest/globals'; -import { makeControlOption } from '../../../../sources/js/src/utils/make-control-option'; +import { makeControlOption } from '../../../../sources/client/src/utils/make-control-option'; describe('makeControlOption', () => { it('shall return a readonly object of Control Option Type', () => { diff --git a/tests/js/unit/utils/ordered-selected-options-at-the-top.test.ts b/tests/client/unit/utils/ordered-selected-options-at-the-top.test.ts similarity index 97% rename from tests/js/unit/utils/ordered-selected-options-at-the-top.test.ts rename to tests/client/unit/utils/ordered-selected-options-at-the-top.test.ts index a30d801..227e82c 100644 --- a/tests/js/unit/utils/ordered-selected-options-at-the-top.test.ts +++ b/tests/client/unit/utils/ordered-selected-options-at-the-top.test.ts @@ -5,7 +5,7 @@ import { describe, expect, it } from '@jest/globals'; import { faker } from '@faker-js/faker'; -import { orderSelectedOptionsAtTheTop } from '../../../../sources/js/src/utils/order-selected-options-at-the-top'; +import { orderSelectedOptionsAtTheTop } from '../../../../sources/client/src/utils/order-selected-options-at-the-top'; describe('Ordered Selected Options at the Top', () => { /* diff --git a/tests/js/unit/utils/unique-control-options.test.ts b/tests/client/unit/utils/unique-control-options.test.ts similarity index 87% rename from tests/js/unit/utils/unique-control-options.test.ts rename to tests/client/unit/utils/unique-control-options.test.ts index a71db49..7027fc3 100644 --- a/tests/js/unit/utils/unique-control-options.test.ts +++ b/tests/client/unit/utils/unique-control-options.test.ts @@ -3,7 +3,7 @@ import { OrderedSet } from 'immutable'; import { describe, expect, it } from '@jest/globals'; -import { uniqueControlOptions } from '../../../../sources/js/src/utils/unique-control-options'; +import { uniqueControlOptions } from '../../../../sources/client/src/utils/unique-control-options'; describe('Unique Control Options', () => { it('Do not allow same control options within the same set', () => { diff --git a/tsconfig.json b/tsconfig.json index c4e63e0..2dfa870 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -27,6 +27,6 @@ "@types": ["./@types/index.d.ts"] } }, - "include": ["@types", "sources/js/**/*", "tests/js/**/*"], + "include": ["@types", "sources/client/**/*", "tests/client/**/*"], "exclude": ["node_modules"] } diff --git a/webpack.config.js b/webpack.config.js index 25e4108..0d2506e 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -4,7 +4,7 @@ const path = require('path'); module.exports = { ...baseConfiguration, - entry: './sources/js/src/index.ts', + entry: './sources/client/src/index.ts', plugins: [ ...baseConfiguration.plugins.filter( (plugin) =>