@contentful/field-editor-validation-errors 3.1.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
value: true
|
|
4
4
|
});
|
|
5
5
|
const _react = /*#__PURE__*/ _interop_require_wildcard(require("react"));
|
|
6
|
-
require("@testing-library/jest-dom/extend-expect");
|
|
7
6
|
const _fieldeditortestutils = /*#__PURE__*/ _interop_require_wildcard(require("@contentful/field-editor-test-utils"));
|
|
8
7
|
const _react1 = require("@testing-library/react");
|
|
8
|
+
const _vitest = require("vitest");
|
|
9
9
|
const _ValidationErrors = require("./ValidationErrors");
|
|
10
10
|
function _getRequireWildcardCache(nodeInterop) {
|
|
11
11
|
if (typeof WeakMap !== "function") return null;
|
|
@@ -70,12 +70,12 @@ const createEntry = (id)=>({
|
|
|
70
70
|
});
|
|
71
71
|
const cma = {
|
|
72
72
|
entry: {
|
|
73
|
-
getMany:
|
|
73
|
+
getMany: _vitest.vi.fn().mockReturnValue({
|
|
74
74
|
items: []
|
|
75
75
|
})
|
|
76
76
|
},
|
|
77
77
|
contentType: {
|
|
78
|
-
getMany:
|
|
78
|
+
getMany: _vitest.vi.fn().mockResolvedValue({
|
|
79
79
|
items: [
|
|
80
80
|
{
|
|
81
81
|
sys: {
|
|
@@ -95,9 +95,9 @@ const cma = {
|
|
|
95
95
|
})
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
|
-
describe('ValidationErrors', ()=>{
|
|
99
|
-
afterEach(_react1.cleanup);
|
|
100
|
-
it('renders without crashing', ()=>{
|
|
98
|
+
(0, _vitest.describe)('ValidationErrors', ()=>{
|
|
99
|
+
(0, _vitest.afterEach)(_react1.cleanup);
|
|
100
|
+
(0, _vitest.it)('renders without crashing', ()=>{
|
|
101
101
|
const [field] = _fieldeditortestutils.createFakeFieldAPI();
|
|
102
102
|
const { container } = (0, _react1.render)(/*#__PURE__*/ _react.createElement(_ValidationErrors.ValidationErrors, {
|
|
103
103
|
field: field,
|
|
@@ -105,9 +105,9 @@ describe('ValidationErrors', ()=>{
|
|
|
105
105
|
locales: _fieldeditortestutils.createFakeLocalesAPI(),
|
|
106
106
|
getEntryURL: (entry)=>`url.${entry.sys.id}`
|
|
107
107
|
}));
|
|
108
|
-
expect(container).toBeEmptyDOMElement();
|
|
108
|
+
(0, _vitest.expect)(container).toBeEmptyDOMElement();
|
|
109
109
|
});
|
|
110
|
-
it('should render the list of error messages', async ()=>{
|
|
110
|
+
(0, _vitest.it)('should render the list of error messages', async ()=>{
|
|
111
111
|
const errors = [
|
|
112
112
|
{
|
|
113
113
|
name: 'test-error',
|
|
@@ -133,7 +133,7 @@ describe('ValidationErrors', ()=>{
|
|
|
133
133
|
}
|
|
134
134
|
}));
|
|
135
135
|
});
|
|
136
|
-
it('should fetch & render links to duplicated entries', async ()=>{
|
|
136
|
+
(0, _vitest.it)('should fetch & render links to duplicated entries', async ()=>{
|
|
137
137
|
const ids = [
|
|
138
138
|
'id-0',
|
|
139
139
|
'id-1',
|
|
@@ -169,8 +169,8 @@ describe('ValidationErrors', ()=>{
|
|
|
169
169
|
await findByText(/Loading title for conflicting entry/);
|
|
170
170
|
const links = await findAllByTestId('cf-ui-text-link');
|
|
171
171
|
links.forEach((link, index)=>{
|
|
172
|
-
expect(link).toHaveAttribute('href', 'url.id-' + index);
|
|
173
|
-
expect(link).toHaveTextContent('entry-title-for-id-' + index);
|
|
172
|
+
(0, _vitest.expect)(link).toHaveAttribute('href', 'url.id-' + index);
|
|
173
|
+
(0, _vitest.expect)(link).toHaveTextContent('entry-title-for-id-' + index);
|
|
174
174
|
});
|
|
175
175
|
});
|
|
176
176
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import '@testing-library/jest-dom/extend-expect';
|
|
3
2
|
import * as utils from '@contentful/field-editor-test-utils';
|
|
4
3
|
import { render, configure, cleanup, act } from '@testing-library/react';
|
|
4
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
5
5
|
import { ValidationErrors } from './ValidationErrors';
|
|
6
6
|
configure({
|
|
7
7
|
testIdAttribute: 'data-test-id'
|
|
@@ -25,12 +25,12 @@ const createEntry = (id)=>({
|
|
|
25
25
|
});
|
|
26
26
|
const cma = {
|
|
27
27
|
entry: {
|
|
28
|
-
getMany:
|
|
28
|
+
getMany: vi.fn().mockReturnValue({
|
|
29
29
|
items: []
|
|
30
30
|
})
|
|
31
31
|
},
|
|
32
32
|
contentType: {
|
|
33
|
-
getMany:
|
|
33
|
+
getMany: vi.fn().mockResolvedValue({
|
|
34
34
|
items: [
|
|
35
35
|
{
|
|
36
36
|
sys: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/field-editor-validation-errors",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"main": "dist/cjs/index.js",
|
|
5
5
|
"module": "dist/esm/index.js",
|
|
6
6
|
"types": "dist/types/index.d.ts",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"build:types": "tsc --outDir dist/types --emitDeclarationOnly",
|
|
32
32
|
"build:cjs": "swc src --config-file ../../.swcrc -d dist/cjs -C module.type=commonjs",
|
|
33
33
|
"build:esm": "swc src --config-file ../../.swcrc -d dist/esm",
|
|
34
|
-
"test": "
|
|
35
|
-
"test:ci": "
|
|
34
|
+
"test": "vitest",
|
|
35
|
+
"test:ci": "vitest run",
|
|
36
36
|
"tsc": "tsc -p ./ --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@contentful/f36-components": "^6.7.1",
|
|
40
40
|
"@contentful/f36-icons": "^6.7.1",
|
|
41
41
|
"@contentful/f36-tokens": "^6.1.2",
|
|
42
|
-
"@contentful/field-editor-shared": "^4.4.
|
|
42
|
+
"@contentful/field-editor-shared": "^4.4.1",
|
|
43
43
|
"@emotion/css": "^11.13.5"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@contentful/field-editor-test-utils": "^3.1.
|
|
46
|
+
"@contentful/field-editor-test-utils": "^3.1.1",
|
|
47
47
|
"@lingui/core": "5.3.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"registry": "https://npm.pkg.github.com/"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "5fb6c32d2590e72e56a53cb180a155f84d6505d9"
|
|
59
59
|
}
|