Home / File/ assets-sanitize.spec.ts — vite Source File

assets-sanitize.spec.ts — vite Source File

Architecture documentation for assets-sanitize.spec.ts, a typescript file in the vite codebase. 2 imports, 0 dependents.

File typescript 2 imports

Entity Profile

Dependency Diagram

graph LR
  45bc74d5_8c6e_bcf3_79f4_082794747094["assets-sanitize.spec.ts"]
  a340ba46_b2b7_3048_3bb3_6907a74c8464["vitest"]
  45bc74d5_8c6e_bcf3_79f4_082794747094 --> a340ba46_b2b7_3048_3bb3_6907a74c8464
  d3fd5575_295b_d6be_24dd_62d277645dc9["~utils"]
  45bc74d5_8c6e_bcf3_79f4_082794747094 --> d3fd5575_295b_d6be_24dd_62d277645dc9
  style 45bc74d5_8c6e_bcf3_79f4_082794747094 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import { expect, test } from 'vitest'
import { getBg, isBuild, page, readManifest } from '~utils'

if (!isBuild) {
  test('importing asset with special char in filename works in dev', async () => {
    expect(await getBg('.plus-circle')).toContain('+circle.svg')
    expect(await page.textContent('.plus-circle')).toMatch('+circle.svg')
    expect(await getBg('.underscore-circle')).toContain('_circle.svg')
    expect(await page.textContent('.underscore-circle')).toMatch('_circle.svg')
  })
} else {
  test('importing asset with special char in filename works in build', async () => {
    const manifest = readManifest()
    const plusCircleAsset = manifest['+circle.svg'].file
    const underscoreCircleAsset = manifest['_circle.svg'].file
    expect(await getBg('.plus-circle')).toMatch(plusCircleAsset)
    expect(await page.textContent('.plus-circle')).toMatch(plusCircleAsset)
    expect(await getBg('.underscore-circle')).toMatch(underscoreCircleAsset)
    expect(await page.textContent('.underscore-circle')).toMatch(
      underscoreCircleAsset,
    )
    expect(plusCircleAsset).toMatch('/_circle')
    expect(underscoreCircleAsset).toMatch('/_circle')
    expect(plusCircleAsset).not.toEqual(underscoreCircleAsset)
    expect(Object.keys(manifest).length).toBe(3) // 2 svg, 1 index.js
  })
}

test.runIf(!isBuild)('denied .env', async () => {
  expect(await page.textContent('.unsafe-dotenv')).toBe('403')
  expect(await page.textContent('.unsafe-dotenv-double-slash')).toBe('200') // SPA fallback
})

Dependencies

  • vitest
  • ~utils

Frequently Asked Questions

What does assets-sanitize.spec.ts do?
assets-sanitize.spec.ts is a source file in the vite codebase, written in typescript.
What does assets-sanitize.spec.ts depend on?
assets-sanitize.spec.ts imports 2 module(s): vitest, ~utils.
Where is assets-sanitize.spec.ts in the architecture?
assets-sanitize.spec.ts is located at playground/assets-sanitize/__tests__/assets-sanitize.spec.ts (directory: playground/assets-sanitize/__tests__).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free