🧰 Story 1.2: configuration tailwind
This commit is contained in:
31
tests/tailwind.test.ps1
Normal file
31
tests/tailwind.test.ps1
Normal file
@@ -0,0 +1,31 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Assert-True {
|
||||
param(
|
||||
[bool]$Condition,
|
||||
[string]$Message
|
||||
)
|
||||
if (-not $Condition) { throw $Message }
|
||||
}
|
||||
|
||||
Assert-True (Test-Path 'package.json') 'Missing package.json'
|
||||
$pkg = Get-Content -Raw 'package.json' | ConvertFrom-Json
|
||||
$build = $pkg.scripts.build
|
||||
$dev = $pkg.scripts.dev
|
||||
Assert-True (-not [string]::IsNullOrWhiteSpace($build)) 'Missing npm build script'
|
||||
Assert-True (-not [string]::IsNullOrWhiteSpace($dev)) 'Missing npm dev script'
|
||||
|
||||
Assert-True (Test-Path 'tailwind.config.js') 'Missing tailwind.config.js'
|
||||
Assert-True (Test-Path 'postcss.config.js') 'Missing postcss.config.js'
|
||||
|
||||
Assert-True (Test-Path 'assets/css/input.css') 'Missing assets/css/input.css'
|
||||
$input = Get-Content -Raw 'assets/css/input.css'
|
||||
Assert-True ($input -match '@tailwind base') 'Missing @tailwind base'
|
||||
Assert-True ($input -match '@tailwind components') 'Missing @tailwind components'
|
||||
Assert-True ($input -match '@tailwind utilities') 'Missing @tailwind utilities'
|
||||
|
||||
Assert-True (Test-Path 'assets/css/output.css') 'Missing assets/css/output.css'
|
||||
$size = (Get-Item 'assets/css/output.css').Length
|
||||
Assert-True ($size -lt 51200) "output.css too large: ${size} bytes"
|
||||
|
||||
'OK'
|
||||
Reference in New Issue
Block a user