Skip to content

Commit 46eb30c

Browse files
v1.0.40-beta
1 parent 898de61 commit 46eb30c

7 files changed

Lines changed: 142 additions & 208 deletions

File tree

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -194,33 +194,33 @@ describe({ name: 'DOM Manipulation', id: 'dom_tests' }, () => {
194194
const div = document.createElement('div');
195195
div.textContent = 'Hello World';
196196
div.className = 'test-element';
197-
197+
198198
// Add to DOM
199199
document.body.appendChild(div);
200-
200+
201201
// Test DOM state
202202
assertEqual(div.tagName, 'DIV');
203203
assertEqual(div.textContent, 'Hello World');
204204
assertTrue(document.querySelector('.test-element') !== null);
205-
205+
206206
// Cleanup
207207
document.body.removeChild(div);
208208
});
209209

210210
it({ name: 'should handle events', parentId: 'dom_tests' }, () => {
211211
const button = document.createElement('button');
212212
button.textContent = 'Click me';
213-
213+
214214
let clicked = false;
215215
button.addEventListener('click', () => {
216216
clicked = true;
217217
});
218-
218+
219219
document.body.appendChild(button);
220220
button.click();
221-
221+
222222
assertTrue(clicked, 'Button click should trigger event');
223-
223+
224224
document.body.removeChild(button);
225225
});
226226
});
@@ -239,11 +239,11 @@ describe('Web Components', () => {
239239
this.innerHTML = '<button>Custom Button</button>';
240240
}
241241
}
242-
242+
243243
customElements.define('my-button', MyButton);
244244
const element = document.createElement('my-button');
245245
document.body.appendChild(element);
246-
246+
247247
assertTrue(element.querySelector('button') !== null);
248248
document.body.removeChild(element);
249249
});
@@ -255,11 +255,11 @@ describe('Canvas Operations', () => {
255255
const canvas = document.createElement('canvas');
256256
canvas.width = 100;
257257
canvas.height = 100;
258-
258+
259259
const ctx = canvas.getContext('2d');
260260
ctx.fillStyle = '#ff0000';
261261
ctx.fillRect(0, 0, 50, 50);
262-
262+
263263
const imageData = ctx.getImageData(25, 25, 1, 1);
264264
assertEqual(imageData.data[0], 255); // Red component
265265
});
@@ -270,14 +270,14 @@ describe('Intersection Observer', () => {
270270
it('should observe element visibility', (done) => {
271271
const target = document.createElement('div');
272272
document.body.appendChild(target);
273-
273+
274274
const observer = new IntersectionObserver((entries) => {
275275
const entry = entries[0];
276276
assertTrue(typeof entry.isIntersecting === 'boolean');
277277
observer.disconnect();
278278
document.body.removeChild(target);
279279
});
280-
280+
281281
observer.observe(target);
282282
});
283283
});
@@ -296,7 +296,7 @@ describe('Function Mocking', () => {
296296
it('should mock functions', () => {
297297
const mockFn = mock.fn();
298298
mockFn.mockReturnValue('mocked result');
299-
299+
300300
const result = mockFn();
301301
assertEqual(result, 'mocked result');
302302
assertEqual(mockFn.mock.calls.length, 1);
@@ -316,10 +316,10 @@ describe('HTTP Testing', () => {
316316
url: '/test',
317317
headers: { 'content-type': 'application/json' }
318318
});
319-
319+
320320
assertEqual(req.method, 'GET');
321321
assertEqual(req.url, '/test');
322-
322+
323323
res.status(200).json({ success: true });
324324
assertEqual(res.statusCode, 200);
325325
});
@@ -400,13 +400,13 @@ codi.runWebTests();
400400
<body>
401401
<script type="module">
402402
import { describe, it, assertEqual, runWebTests } from 'https://esm.sh/codi-test-framework';
403-
403+
404404
describe('Browser Tests', () => {
405405
it('should work in browser', () => {
406406
assertEqual(window.location.protocol, 'http:');
407407
});
408408
});
409-
409+
410410
runWebTests();
411411
</script>
412412
</body>
@@ -423,7 +423,7 @@ describe('Async Operations', () => {
423423
const result = await Promise.resolve('async result');
424424
assertEqual(result, 'async result');
425425
});
426-
426+
427427
it('should handle fetch requests', async () => {
428428
const response = await fetch('/api/data');
429429
assertTrue(response.ok, 'Response should be ok');
@@ -440,7 +440,7 @@ describe({ name: 'User Management', id: 'user_mgmt' }, () => {
440440
// test implementation
441441
});
442442
});
443-
443+
444444
describe({ name: 'Authorization', id: 'authz', parentId: 'user_mgmt' }, () => {
445445
it({ name: 'should check permissions', parentId: 'authz' }, () => {
446446
// test implementation
@@ -455,15 +455,15 @@ describe({ name: 'User Management', id: 'user_mgmt' }, () => {
455455
describe('Performance Tests', () => {
456456
it('should measure execution time', () => {
457457
const start = performance.now();
458-
458+
459459
// Operation to measure
460460
for (let i = 0; i < 10000; i++) {
461461
Math.random();
462462
}
463-
463+
464464
const end = performance.now();
465465
const duration = end - start;
466-
466+
467467
assertTrue(duration >= 0, 'Duration should be positive');
468468
console.log(`Operation took ${duration} milliseconds`);
469469
});
@@ -488,13 +488,13 @@ jobs:
488488
- uses: actions/setup-node@v4
489489
with:
490490
node-version: '22'
491-
491+
492492
- name: Install dependencies
493493
run: npm install
494-
494+
495495
- name: Run Node.js tests
496496
run: npx codi tests --returnResults
497-
497+
498498
- name: Run Browser tests
499499
run: npx codi tests --browser --returnResults
500500
```
@@ -579,7 +579,7 @@ This project is licensed under the [MIT License](LICENSE).
579579

580580
## Changelog 📝
581581

582-
### v1.0.39-beta
582+
### v1.0.40-beta
583583
- Enhanced browser testing capabilities
584584
- Added comprehensive web API testing support
585585
- Improved mocking system with HTTP testing
@@ -594,4 +594,4 @@ See [GitHub Releases](https://github.com/RobAndrewHurst/codi/releases) for compl
594594

595595
**Made with ❤️ by [Rob Hurst](https://github.com/RobAndrewHurst)**
596596

597-
*Codi - Because testing should be simple, fast, and work everywhere.* 🐶
597+
*Codi - Because testing should be simple, fast, and work everywhere.* 🐶

0 commit comments

Comments
 (0)