# extendify/3.1.0/tests/unit/Launch/lib/blocks.test.js

Extendify, version 3.1.0. 24 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.1.0/code/tests/unit/Launch/lib/blocks.test.js
- Raw: https://pluginprobe.com/plugins/extendify/3.1.0/raw/tests/unit/Launch/lib/blocks.test.js
- Modified: 2026-06-11T18:37:12+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.1.0/code/tests/unit/Launch/lib/blocks.test.js#L10-L20`.

```javascript
import { addIdAttributeToBlock } from '@launch/lib/blocks';

describe('addIdAttributeToBlock', () => {
	const blockCode = '<div class="wp-block-group something">Content</div>';

	it('adds id attribute to block with wp-block-group class', () => {
		const result = addIdAttributeToBlock(blockCode, 'test-id');
		expect(result).toContain('id="test-id"');
	});

	it('does not break other parts of the HTML', () => {
		const result = addIdAttributeToBlock(blockCode, 'unique-id');
		expect(result).toContain(
			'<div class="wp-block-group something" id="unique-id">',
		);
	});

	it('does nothing if blockCode doesn’t match the expected pattern', () => {
		const input = '<div class="something-else">Hello</div>';
		const result = addIdAttributeToBlock(input, 'abc');
		expect(result).toBe(input);
	});
});

```
