#!/bin/sh
test_description='Check ESI frame and fragment output'
. ./setup.sh
test_expect_success 'esi-diff is a 404 when ESI is disabled' '
cgit_url "foo/esi-diff&id=HEAD" >tmp &&
grep "Status: 404" tmp
'
test_expect_success 'commit page has no ESI markup when ESI is disabled' '
cgit_url "foo/commit" >tmp &&
! grep -e "esi:include" -e "Surrogate-Control" -e ">cgitrc
'
test_expect_success 'generate foo/commit frame' '
head=$(cd repos/foo && git rev-parse HEAD) &&
parent=$(cd repos/foo && git rev-parse HEAD^) &&
cgit_url "foo/commit" >tmp
'
test_expect_success 'frame announces ESI' '
grep "^Surrogate-Control: content=.ESI/1.0.$" tmp
'
test_expect_success 'frame sets base to the repo root' '
grep "" tmp
'
test_expect_success 'frame keeps header, tabs and commit info' '
grep "