-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add pattern to include Svelte page files in Vitest configuration
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { | ||
rejected_extensions, | ||
rejected_paths, | ||
} from './reject-patterns' | ||
|
||
describe('reject patterns', () => { | ||
describe('rejected_extensions', () => { | ||
it('should contain common unsafe file extensions', () => { | ||
expect(rejected_extensions).toContain('.php') | ||
expect(rejected_extensions).toContain('.exe') | ||
expect(rejected_extensions).toContain('.env') | ||
}) | ||
|
||
it('should not allow empty extensions', () => { | ||
expect(rejected_extensions.includes('')).toBe(false) | ||
}) | ||
|
||
it('should all start with a dot', () => { | ||
rejected_extensions.forEach(ext => { | ||
expect(ext.startsWith('.')).toBe(true) | ||
}) | ||
}) | ||
}) | ||
|
||
describe('rejected_paths', () => { | ||
it('should contain common unsafe paths', () => { | ||
expect(rejected_paths).toContain('/wp-admin') | ||
expect(rejected_paths).toContain('/phpmyadmin') | ||
expect(rejected_paths).toContain('/admin') | ||
}) | ||
|
||
it('should all start with a forward slash', () => { | ||
rejected_paths.forEach(path => { | ||
expect(path.startsWith('/')).toBe(true) | ||
}) | ||
}) | ||
|
||
it('should not contain trailing slashes', () => { | ||
rejected_paths.forEach(path => { | ||
expect(path.endsWith('/')).toBe(false) | ||
}) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters