Skip to content
This repository was archived by the owner on Jan 31, 2024. It is now read-only.

Commit 6d4dd05

Browse files
authored
Merge pull request #2 from storybookjs/chore/update-package-name
chore: update package name
2 parents 80ab0ea + caa1a8a commit 6d4dd05

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You are using [Storybook](https://storybook.js.org/) for you components and writ
1212

1313
## The solution
1414

15-
`@storybook/react-testing` is a solution to reuse your Storybook stories in your React tests. By reusing your stories in your tests, you have a catalog of component scenarios ready to be tested. All [args](https://storybook.js.org/docs/react/writing-stories/args) and [decorators](https://storybook.js.org/docs/react/writing-stories/decorators) from your [story](https://storybook.js.org/docs/react/api/csf#named-story-exports) and its [meta](https://storybook.js.org/docs/react/api/csf#default-export), and also [global decorators](https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators), will be composed by this library and returned to you in a simple component. This way, in your unit tests, all you have to do is select which story you want to render, and all the necessary setup will be already done for you. This is the missing piece that allows for better shareability and maintenance between writing tests and writing Storybook stories.
15+
`@storybook/testing-react` is a solution to reuse your Storybook stories in your React tests. By reusing your stories in your tests, you have a catalog of component scenarios ready to be tested. All [args](https://storybook.js.org/docs/react/writing-stories/args) and [decorators](https://storybook.js.org/docs/react/writing-stories/decorators) from your [story](https://storybook.js.org/docs/react/api/csf#named-story-exports) and its [meta](https://storybook.js.org/docs/react/api/csf#default-export), and also [global decorators](https://storybook.js.org/docs/react/writing-stories/decorators#global-decorators), will be composed by this library and returned to you in a simple component. This way, in your unit tests, all you have to do is select which story you want to render, and all the necessary setup will be already done for you. This is the missing piece that allows for better shareability and maintenance between writing tests and writing Storybook stories.
1616

1717
## Installation
1818

@@ -21,13 +21,13 @@ This library should be installed as one of your project's `devDependencies`:
2121
via [npm](https://www.npmjs.com/)
2222

2323
```
24-
npm install --save-dev @storybook/react-testing
24+
npm install --save-dev @storybook/testing-react
2525
```
2626

2727
or via [yarn](https://classic.yarnpkg.com/)
2828

2929
```
30-
yarn add --dev @storybook/react-testing
30+
yarn add --dev @storybook/testing-react
3131
```
3232

3333
## Setup
@@ -69,7 +69,7 @@ If you use the composed story (e.g. PrimaryButton), the component will render wi
6969

7070
```tsx
7171
import { render } from '@testing-library/react';
72-
import { composeStories } from '@storybook/react-testing';
72+
import { composeStories } from '@storybook/testing-react';
7373
import * as stories from './Button.stories'; // import all stories from the stories file
7474

7575
// Every component that is returned maps 1:1 with the stories, but they already contain all decorators from story level, meta level and global level.
@@ -96,7 +96,7 @@ You can use `composeStory` if you wish to apply it for a single story rather tha
9696

9797
```tsx
9898
import { render } from '@testing-library/react';
99-
import { composeStory } from '@storybook/react-testing';
99+
import { composeStory } from '@storybook/testing-react';
100100
import Meta, { Primary as PrimaryStory } from './Button.stories';
101101

102102
// Returns a component that already contain all decorators from story level, meta level and global level.
@@ -113,7 +113,7 @@ test('onclick handler is called', async () => {
113113

114114
## Typescript
115115

116-
`@storybook/react-testing` is typescript ready and provides autocompletion to easily detect all stories of your component:
116+
`@storybook/testing-react` is typescript ready and provides autocompletion to easily detect all stories of your component:
117117

118118
![component autocompletion](https://user-images.githubusercontent.com/1671563/111436219-034d1600-8702-11eb-82bb-36913b235787.png)
119119

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "@storybook/react-testing",
2+
"name": "@storybook/testing-react",
33
"version": "0.0.3",
44
"description": "Testing utilities that allow you to reuse your stories in your unit tests",
55
"keywords": [
@@ -75,4 +75,4 @@
7575
"publishConfig": {
7676
"access": "public"
7777
}
78-
}
78+
}

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let globalStorybookConfig = {};
1111
* Example:
1212
*```jsx
1313
* // setup.js (for jest)
14-
* import { setGlobalConfig } from '@storybook/react-testing';
14+
* import { setGlobalConfig } from '@storybook/testing-react';
1515
* import * as globalStorybookConfig from './.storybook/preview';
1616
*
1717
* setGlobalConfig(globalStorybookConfig);
@@ -34,7 +34,7 @@ export function setGlobalConfig(config: GlobalConfig) {
3434
* Example:
3535
*```jsx
3636
* import { render } from '@testing-library/react';
37-
* import { composeStory } from '@storybook/react-testing';
37+
* import { composeStory } from '@storybook/testing-react';
3838
* import Meta, { Primary as PrimaryStory } from './Button.stories';
3939
*
4040
* const Primary = composeStory(PrimaryStory, Meta);
@@ -106,7 +106,7 @@ export function composeStory<GenericArgs>(
106106
* Example:
107107
*```jsx
108108
* import { render } from '@testing-library/react';
109-
* import { composeStories } from '@storybook/react-testing';
109+
* import { composeStories } from '@storybook/testing-react';
110110
* import * as stories from './Button.stories';
111111
*
112112
* const { Primary, Secondary } = composeStories(stories);

0 commit comments

Comments
 (0)