fix(nexxa): 1.4.1 — cache busting de js/css en nexxa-web (?v=VERSION) y HTML no-cache
Tests ADN / test (push) Canceled after 0s
Tests ADN / test (push) Canceled after 0s
Tras un deploy el navegador seguía usando el app.js viejo (FileHandler sin Cache-Control): el menú Pools nuevo mostraba la sección vacía. Ahora cada versión fuerza la descarga de los estáticos nuevos. Test en el humo HTTP (53). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: GEMMA <noreply@gemma.dtic>
This commit is contained in:
co-authored by
Claude Opus 5.5
GEMMA
parent
0e0b50b32b
commit
0b1ff7e3a2
@@ -13,6 +13,7 @@ PRUEBA = ServidorPrueba.armar(individuos: %w[gemma-humo liberar-humo])
|
||||
PUERTO = PRUEBA[:puerto]
|
||||
TOKEN_IND = PRUEBA[:tokens]['gemma-humo']
|
||||
TOKEN_LIB = PRUEBA[:tokens]['liberar-humo'] # individuo propio del test de liberar: no comparte estado
|
||||
BASE_NEXXA_ORG = File.join(ServidorPrueba::BASE, 'organismo')
|
||||
PID = ServidorPrueba.arrancar(PRUEBA)
|
||||
Minitest.after_run { ServidorPrueba.detener(PID, PRUEBA) }
|
||||
|
||||
@@ -124,6 +125,20 @@ class HumoHttpTest < Minitest::Test
|
||||
assert_nil pedir('get', '/pools', sesion: SES_OPER)[1].dig('individuos', 'revocar-humo')
|
||||
end
|
||||
|
||||
# Cache busting: el HTML referencia js/css con ?v=<versión> y no se cachea (P335: app.js viejo dejaba Pools vacío)
|
||||
def test_html_trae_estaticos_con_version_y_no_se_cachea
|
||||
version = File.read(File.join(BASE_NEXXA_ORG, 'VERSION')).strip
|
||||
r = Net::HTTP.start('127.0.0.1', PUERTO) { |h| h.get('/') } # sin sesión: login.html
|
||||
assert_includes r.body, "/css/estilos.css?v=#{version}"
|
||||
assert_includes r.body, "/js/login.js?v=#{version}"
|
||||
assert_equal 'no-cache', r['Cache-Control']
|
||||
req = Net::HTTP::Get.new('/')
|
||||
req['Cookie'] = "nexxa_session=#{SES_OPER}"
|
||||
r = Net::HTTP.start('127.0.0.1', PUERTO) { |h| h.request(req) } # con sesión: index.html
|
||||
assert_includes r.body, "/js/app.js?v=#{version}"
|
||||
assert_equal 200, Net::HTTP.start('127.0.0.1', PUERTO) { |h| h.get("/js/app.js?v=#{version}") }.code.to_i
|
||||
end
|
||||
|
||||
def test_sin_token_ni_sesion
|
||||
assert_equal 401, pedir('get', '/disponible/mente')[0]
|
||||
assert_equal 401, pedir('get', '/pools')[0]
|
||||
|
||||
Reference in New Issue
Block a user