Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vhoyer/lazy-let
An utility for using lazy variables in a BDD test environment with nested `describe`s, and `it`s.
https://github.com/vhoyer/lazy-let
bdd hacktoberfest testing
Last synced: 1 day ago
JSON representation
An utility for using lazy variables in a BDD test environment with nested `describe`s, and `it`s.
- Host: GitHub
- URL: https://github.com/vhoyer/lazy-let
- Owner: vhoyer
- License: mit
- Created: 2022-08-18T13:18:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-20T14:52:05.000Z (almost 2 years ago)
- Last Synced: 2025-02-05T15:17:37.819Z (10 days ago)
- Topics: bdd, hacktoberfest, testing
- Language: TypeScript
- Homepage:
- Size: 1.82 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `@vhoyer/lazy-let`
[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/vhoyer/lazy-let/ci.yml?label=ci)](https://github.com/vhoyer/lazy-let)
[![bundle size](https://img.shields.io/bundlephobia/min/@vhoyer/lazy-let)](https://bundlephobia.com/package/@vhoyer/lazy-let)
[![npm](https://img.shields.io/npm/dw/@vhoyer/lazy-let?label=npm%20downloads)](https://www.npmjs.com/package/@vhoyer/lazy-let)An utility for using lazy variables in a BDD test environment with nested `describe`s, and `it`s.
## Installation
```bash
npm install --save-dev @vhoyer/lazy-let
```## Usage
```javascript
import { describe, it, expect, afterEach } from 'vitest';
import { lazylet } from '@vhoyer/lazy-let';
import { render } from '@testing-library/vue';
import MyFooter from '../my-footer.vue';describe('dummy test', () => {
const $0 = lazylet(afterEach, {
value: () => 1,
wrapper: () => render(MyFooter, {
props: $0.props, // defaults to undefined
}),
});it('renders', () => {
expect($0.wrapper.container).toMatchSnapshot();
});describe('change props', () => {
const $1 = $0(beforeEach, {
props: () => ({ prop: $1.value }),
propsAlternative: ($) => ({ prop: $.value }),
});it('renders different', () => {
expect($1.wrapper.container).toMatchSnapshot();
});
});
});
```