37 lines
1.2 KiB
PowerShell
37 lines
1.2 KiB
PowerShell
$ErrorActionPreference = 'Stop'
|
|
|
|
$root = Split-Path -Parent $PSScriptRoot
|
|
$pages = [ordered]@{
|
|
'index.html' = 'home'
|
|
'receive.html' = 'receive'
|
|
'pallet.html' = 'pallet'
|
|
'express-signin.html' = 'express-signin'
|
|
'consolidation.html' = 'consolidation'
|
|
'pick.html' = 'pick'
|
|
'handover.html' = 'handover'
|
|
'packing.html' = 'packing'
|
|
'relabel.html' = 'relabel'
|
|
'exception.html' = 'exception'
|
|
}
|
|
|
|
foreach ($entry in $pages.GetEnumerator()) {
|
|
$path = Join-Path $root $entry.Key
|
|
if (-not (Test-Path -LiteralPath $path -PathType Leaf)) {
|
|
throw "Missing section page: $($entry.Key)"
|
|
}
|
|
|
|
$html = Get-Content -Raw -Encoding UTF8 -LiteralPath $path
|
|
if ($html -notmatch '<!doctype html>') { throw "$($entry.Key) is not an HTML document" }
|
|
if ($html -notmatch "<body data-section=`"$([regex]::Escape($entry.Value))`">") {
|
|
throw "$($entry.Key) does not declare section $($entry.Value)"
|
|
}
|
|
if ($html -notmatch '<link rel="stylesheet" href="assets/app\.css">') {
|
|
throw "$($entry.Key) does not load the shared stylesheet"
|
|
}
|
|
if ($html -notmatch '<script src="assets/app\.js"></script>') {
|
|
throw "$($entry.Key) does not load the shared application script"
|
|
}
|
|
}
|
|
|
|
Write-Output "PASS: $($pages.Count) section pages load the shared application assets"
|