Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/Sitecore/jss into feature/51…
Browse files Browse the repository at this point in the history
…3285
  • Loading branch information
illiakovalenko committed Dec 19, 2022
2 parents 1fb9ac7 + 19c777f commit 8edc25d
Show file tree
Hide file tree
Showing 19 changed files with 118 additions and 42 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"packages/*",
"samples/*"
],
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"npmClient": "yarn",
"useWorkspaces": true
}
2 changes: 1 addition & 1 deletion packages/create-sitecore-jss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-sitecore-jss",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "Sitecore JSS initializer",
"bin": "./dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-angular-schematics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-angular-schematics",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "Scaffolding schematics for Sitecore JSS Angular apps",
"scripts": {
"build": "tsc -p tsconfig.json",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-angular/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-angular",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "",
"scripts": {
"build": "ng-packagr -p ng-package.json",
Expand Down Expand Up @@ -58,7 +58,7 @@
"rxjs": "~6.6.6"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54"
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55"
},
"main": "dist/bundles/sitecore-jss-sitecore-jss-angular.umd.js",
"module": "dist/fesm2015/sitecore-jss-sitecore-jss-angular.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-cli",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "Sitecore JSS command-line",
"main": "dist/cjs/cli.js",
"module": "dist/esm/cli.js",
Expand Down Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/sitecore/jss/issues"
},
"dependencies": {
"@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.55",
"chalk": "^2.4.2",
"cross-spawn": "^7.0.0",
"dotenv": "^16.0.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-dev-tools/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-dev-tools",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "Utilities to assist in the development and deployment of Sitecore JSS apps.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -33,7 +33,7 @@
"url": "https://github.com/sitecore/jss/issues"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55",
"axios": "^0.21.1",
"chalk": "^2.4.1",
"chokidar": "^3.5.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-forms",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -44,7 +44,7 @@
"typescript": "~4.3.5"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54"
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55"
},
"description": "",
"types": "types/index.d.ts",
Expand Down
8 changes: 4 additions & 4 deletions packages/sitecore-jss-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-nextjs",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -70,9 +70,9 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55",
"@sitecore-jss/sitecore-jss-dev-tools": "^21.1.0-canary.55",
"@sitecore-jss/sitecore-jss-react": "^21.1.0-canary.55",
"node-html-parser": "^6.0.0",
"prop-types": "^15.8.1",
"regex-parser": "^2.2.11",
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-proxy",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "Proxy middleware for express.js server.",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-react-forms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-react-forms",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -55,7 +55,7 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@sitecore-jss/sitecore-jss-forms": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss-forms": "^21.1.0-canary.55",
"prop-types": "^15.8.1"
},
"description": "",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-react-native",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -28,7 +28,7 @@
"url": "https://github.com/sitecore/jss/issues"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55",
"prop-types": "^15.7.2",
"react-native-htmlview": "^0.15.0",
"react-native-svg": "^5.3.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-react",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down Expand Up @@ -61,7 +61,7 @@
"react-dom": "^18.2.0"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55",
"deep-equal": "^2.1.0",
"html-react-parser": "^3.0.4",
"prop-types": "^15.8.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss-rendering-host/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-rendering-host",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down
4 changes: 2 additions & 2 deletions packages/sitecore-jss-vue/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss-vue",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"description": "A library for building Sitecore JSS apps using Vue.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -49,7 +49,7 @@
"vue": "^v3.1.0-beta.6"
},
"dependencies": {
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.54",
"@sitecore-jss/sitecore-jss": "^21.1.0-canary.55",
"@vue/compiler-sfc": "^3.0.11"
},
"types": "./types/index.d.ts",
Expand Down
5 changes: 4 additions & 1 deletion packages/sitecore-jss/.nycrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
".ts"
],
"exclude": [
"**/index.ts",
"**/*.d.ts",
"**/*.test.ts",
"src/test-data",
Expand All @@ -11,7 +12,9 @@
"src/index.ts",
"src/dataModels.ts",
"./*.js",
"./*.d.ts"
"./*.d.ts",
"**/layout/models.ts",
"*.js"
],
"all": true,
"reporter": [
Expand Down
2 changes: 1 addition & 1 deletion packages/sitecore-jss/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sitecore-jss/sitecore-jss",
"version": "21.1.0-canary.54",
"version": "21.1.0-canary.55",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"sideEffects": false,
Expand Down
17 changes: 17 additions & 0 deletions packages/sitecore-jss/src/graphql/graphql.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* eslint-disable no-unused-expressions */
import { expect } from 'chai';
import { getAppRootId, siteNameError, languageError } from './app-root-query';
import { SearchQueryService } from './search-service';
import { GraphQLRequestClient } from './../graphql-request-client';
import appRootQueryResponse from '../test-data/mockAppRootQueryResponse.json';
import nock from 'nock';
Expand Down Expand Up @@ -150,4 +151,20 @@ describe('graphql', () => {
});
});
});

describe('search-service', () => {
const endpoint = 'http://site';
const apiKey = 'api-key';
const client = new GraphQLRequestClient(endpoint, { apiKey });
const searchService = new SearchQueryService(client);

it('should throw when rootItemId is missing', async () => {
const result = searchService.fetch('mockQuery', {
language: 'en',
});
await result.catch((error: RangeError) => {
expect(error.message).to.equal('"rootItemId" and "language" must be non-empty strings');
});
});
});
});
56 changes: 56 additions & 0 deletions packages/sitecore-jss/src/layout/utils.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* eslint-disable no-unused-expressions */
import { expect } from 'chai';
import { ComponentRendering } from '../../layout';
import { getFieldValue, getChildPlaceholder } from './utils';

describe('sitecore-jss layout utils', () => {
describe('getFieldValue', () => {
const fields = {
crop: {
value: 'rice',
},
};

it('should read field from ComponentRendering type', () => {
const componentRendering: ComponentRendering = {
componentName: 'uTest',
fields: fields,
};

const result = getFieldValue(componentRendering, 'crop');
expect(result).to.be.equal('rice');
});

it('should read field from Fields type', () => {
expect(getFieldValue(fields, 'crop')).to.be.equal('rice');
});

it('should return default value when field is not found', () => {
const defaultYield = '1000 tn';
expect(getFieldValue(fields, 'yield', defaultYield)).to.be.equal(defaultYield);
});
});

describe('getChildPlaceholder', () => {
it('should return child placeholder', () => {
const testRendering: ComponentRendering = {
componentName: 'test',
placeholders: {
place: [
{
componentName: 'placed',
},
],
holder: [
{
componentName: 'held',
},
],
},
};
const result = getChildPlaceholder(testRendering, 'place');
expect(result.length).to.be.equal(1);
expect((result[0] as ComponentRendering).componentName).to.be.equal('placed');
});
});
});
Loading

0 comments on commit 8edc25d

Please sign in to comment.