Skip to content

Commit 81a4d7f

Browse files
committed
test: fix test configuration, update snapshots
1 parent b40c300 commit 81a4d7f

File tree

13 files changed

+843
-12
lines changed

13 files changed

+843
-12
lines changed

.babelrc renamed to babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{
1+
module.exports = {
22
"presets": [
33
[
44
"@babel/env",

jest.config.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const path = require('path');
2+
3+
module.exports = {
4+
rootDir: path.resolve(__dirname, './'),
5+
moduleFileExtensions: ['js', 'json', 'jsx'],
6+
transform: {
7+
'.*\\.js$': '<rootDir>/node_modules/babel-jest',
8+
'.*\\.jsx$': '<rootDir>/node_modules/babel-jest'
9+
},
10+
moduleNameMapper: {
11+
"\\.(css|less)$": "<rootDir>/src/styleMock.js"
12+
},
13+
transformIgnorePatterns: [
14+
"node_modules/(?!(@coreui|tippy.js|perfect-scrollbar)/)"
15+
],
16+
coverageDirectory: '<rootDir>/coverage',
17+
collectCoverageFrom: [
18+
'src/**/*.{js,jsx}',
19+
'!src/index.umd.js',
20+
'!**/node_modules/**'
21+
]
22+
};

package.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,7 @@
102102
"sinon": "^9.0.3",
103103
"webpack": "^4.43.0"
104104
},
105-
"jest": {
106-
"moduleNameMapper": {
107-
"\\.(css|less)$": "<rootDir>/tests/__mocks__/styleMock.js"
108-
},
109-
"transformIgnorePatterns": [
110-
"<rootDir>/node_modules/"
111-
]
112-
},
105+
113106
"repository": {
114107
"type": "git",
115108
"url": "https://github.com/coreui/coreui-react.git"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CAlert renders basic wrapper correctly 1`] = `
4+
<div
5+
className="alert fade"
6+
role="alert"
7+
/>
8+
`;
9+
10+
exports[`CAlert renders customized wrapper correctly 1`] = `
11+
<div
12+
className="class-name alert alert-warning alert-dismissible fade"
13+
role="alert"
14+
>
15+
CAlert
16+
<button
17+
aria-label="Close"
18+
className="close"
19+
onClick={[Function]}
20+
>
21+
×
22+
</button>
23+
</div>
24+
`;

src/dropdown/tests/__snapshots__/CDropdownToggle.test.js.snap

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ exports[`CDropdownToggle renders basic wrapper correctly 1`] = `
1010
aria-label="Dropdown toggle"
1111
className="dropdown-toggle btn"
1212
onClick={[Function]}
13+
role={null}
1314
type="button"
1415
/>
1516
</div>
@@ -26,6 +27,7 @@ exports[`CDropdownToggle renders customized wrapper correctly 1`] = `
2627
className="class-name dropdown-toggle btn disabled"
2728
disabled={true}
2829
onClick={[Function]}
30+
role={null}
2931
type="button"
3032
>
3133
CDropdownToggle
@@ -52,6 +54,7 @@ exports[`CDropdownToggle renders customized wrapper witch split 1`] = `
5254
className="dropdown-toggle dropdown-toggle-split btn disabled"
5355
disabled={true}
5456
onClick={[Function]}
57+
role={null}
5558
type="button"
5659
>
5760
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`CFade renders basic wrapper correctly 1`] = `
4+
<div
5+
className="fade"
6+
/>
7+
`;
8+
9+
exports[`CFade renders customized wrapper correctly 1`] = `
10+
<div
11+
className="class-name base-class"
12+
>
13+
CFade
14+
</div>
15+
`;

src/modal/tests/__snapshots__/CModal.test.js.snap

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ exports[`CModal renders basic wrapper correctly 1`] = `
1919
/>
2020
</div>
2121
</div>
22-
2322
</div>
2423
`;
2524

@@ -28,7 +27,7 @@ exports[`CModal renders customized wrapper correctly 1`] = `
2827
onClick={[Function]}
2928
>
3029
<div
31-
className="modal overflow-auto fade modal-warning"
30+
className="modal overflow-auto fade modal-warning d-block"
3231
data-modal={true}
3332
role="dialog"
3433
tabIndex="-1"
@@ -44,6 +43,8 @@ exports[`CModal renders customized wrapper correctly 1`] = `
4443
</div>
4544
</div>
4645
</div>
47-
46+
<div
47+
className="modal-backdrop fade show"
48+
/>
4849
</div>
4950
`;

src/styleMock.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = {};

0 commit comments

Comments
 (0)