forked from DTStack/molecule
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(jest): supported DOM Testing and Snapshort Testing
Jest integrated with react-testing-library and react-test-renderer, now supported DOM Testing and Snapshort Testing. and put some simple testing examples below the __tests__ folder. re DTStack#8
- Loading branch information
Showing
9 changed files
with
160 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ commitlint.config.js | |
tsconfig.build.json | ||
tsconfig.base.json | ||
jest.config.js | ||
lib/test | ||
lib/stories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = 'test-file-stub'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
module.exports = { | ||
languages: { | ||
register: function (language) {}, | ||
setMonarchTokensProvider: function (name, tokens) {}, | ||
registerCompletionItemProvider: function (name, provider) {}, | ||
}, | ||
editor: { | ||
defineTheme: function (name, theme) {}, | ||
setTheme: function (theme) {}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import * as React from 'react'; | ||
import { render, screen } from '@testing-library/react'; | ||
|
||
import ActionBar from '../index'; | ||
|
||
const mockData = [ | ||
{ | ||
id: '1', | ||
title: 'bar1', | ||
iconName: 'codicon-add', | ||
}, | ||
{ | ||
id: '2', | ||
title: 'bar2', | ||
iconName: 'codicon-chrome-restore', | ||
}, | ||
{ | ||
id: '3', | ||
title: 'bar3', | ||
iconName: 'codicon-check', | ||
}, | ||
]; | ||
|
||
describe('Test ActionBar Component', () => { | ||
|
||
test('Shows the ActionBar by data Props', () => { | ||
expect(1 + 1).toEqual(2); | ||
render(<ActionBar data={mockData} />); | ||
|
||
expect(screen.getByTitle(/bar1/)).not.toBeNull(); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters