Refactor integration tests and add feature-specific test suites
Moves Git, Git LFS, and authentication header forwarding tests from integration.test.js into dedicated feature test files under test/features/. Updates range-cache, security, and container-registry tests for consistency and minor improvements. Refactors src/index.js for code style and readability, especially around cache logic and error handling.
This commit is contained in:
1 parent
44b54580ad
commit
ce93ea9861
8 files changed
+275
-282
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import { beforeAll, describe, expect, it } from 'vitest';
|
||||
import { SELF } from 'cloudflare:test';
|
||||
import { describe, expect, it } from 'vitest';
|
||||
|
||||
/**
|
||||
* Tests for Range Request Caching Strategy
|
||||
@@ -11,17 +12,6 @@ import { beforeAll, describe, expect, it } from 'vitest';
|
||||
*/
|
||||
|
||||
describe('Range Request Caching Strategy', () => {
|
||||
/** @type {any} */
|
||||
let SELF;
|
||||
|
||||
beforeAll(async () => {
|
||||
const { unstable_dev: unstableDev } = await import('wrangler');
|
||||
const worker = await unstableDev('src/index.js', {
|
||||
experimental: { disableExperimentalWarning: true }
|
||||
});
|
||||
SELF = worker;
|
||||
});
|
||||
|
||||
describe('Cache Behavior for Range Requests', () => {
|
||||
it('should not attempt to cache 206 responses', async () => {
|
||||
const testUrl = 'https://example.com/gh/test/repo/sample.pdf';
|
||||
@@ -44,7 +34,7 @@ describe('Range Request Caching Strategy', () => {
|
||||
|
||||
// Should not contain any cache put errors
|
||||
const errorKeys = Object.keys(parsedMetrics).filter(
|
||||
key => key.includes('error') || key.includes('fail')
|
||||
key => (key.includes('error') || key.includes('fail')) && key !== 'client_error'
|
||||
);
|
||||
expect(errorKeys).toHaveLength(0);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user