Skip to content

Commit

Permalink
Update source directories
Browse files Browse the repository at this point in the history
  • Loading branch information
widoz committed Jan 15, 2024
1 parent cb97725 commit 6b20073
Show file tree
Hide file tree
Showing 57 changed files with 38 additions and 38 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"version": "1.0.0",
"autoload": {
"psr-4": {
"Widoz\\EntitiesSearch\\": "sources/php/src/"
"Widoz\\EntitiesSearch\\": "sources/server/src/"
}
},
"authors": [
Expand Down
2 changes: 1 addition & 1 deletion jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
moduleDirectories: ['node_modules'],
setupFilesAfterEnv: ['<rootDir>/tests/js/setup-tests.ts'],
setupFilesAfterEnv: ['<rootDir>/tests/client/setup-tests.ts'],
};
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<ruleset>
<file>./sources/php/</file>
<file>./sources/server/</file>

<arg value="sp"/>
<arg name="colors"/>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ 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,
);

\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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
};
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<number>;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
"@types": ["./@types/index.d.ts"]
}
},
"include": ["@types", "sources/js/**/*", "tests/js/**/*"],
"include": ["@types", "sources/client/**/*", "tests/client/**/*"],
"exclude": ["node_modules"]
}
2 changes: 1 addition & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit 6b20073

Please sign in to comment.