https://github.com/widgetbook/widgetbook_test_demo
https://github.com/widgetbook/widgetbook_test_demo
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/widgetbook/widgetbook_test_demo
- Owner: widgetbook
- Created: 2023-08-24T14:12:06.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2023-10-08T13:46:19.000Z (over 2 years ago)
- Last Synced: 2025-03-13T03:29:02.065Z (over 1 year ago)
- Language: Dart
- Size: 45.9 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Golden Testing with Widgetbook
This repo provides a very initial design of how should Golden Testing be supported in Widgetbook.
We currently discussing creating a new package called `widgetbook_test` that will provide the necessary
utilities and code generation to support Golden Testing.
> [!WARNING]
> The code in this repository is highly hypothetical, and **DOES NOT WORK**.
> It is only meant to show the syntax and the outcome of code generation.
## Files
| File | Description |
| ---------------------------------------------------------------------- | ---------------------------------------------------- |
| [`foo_widget.dart`](./lib/foo_widget.dart) | The widget file |
| [`foo_widget.usecase.dart`](./lib/foo_widget.usecase.dart) | Contains functions annotated with `@UseCase(...)` |
| [`widgetbook.scenarios.g.dart`](./test/widgetbook.scenarios.g.dart) | `WidgetbookTestScenario` For each `@UseCase` element |
| [`golden_test.dart`](./test/golden_test.dart) | A normal golden test file using alchemist |
## Flow
```mermaid
stateDiagram-v2
Widget --> @UseCase
@UseCase --> widgetbook.directories.g.dart: WidgetbookUseCase
widgetbook.directories.g.dart --> widgetbook.dart: Used in
@UseCase --> widgetbook.scenarios.g.dart: WidgetbookTestScenario
widgetbook.scenarios.g.dart --> golden_test.dart: Used in
```