#[test]
fn unknown_preview() {
let server = TestServer::new_with_regtest();
server.mine_blocks(1);
let txid = server.bitcoin_rpc_server.broadcast_tx(TransactionTemplate {
inputs: &[(1, 0, 0, inscription("text/foo", "hello").to_witness())],
..Default::default()
});
server.mine_blocks(1);
server.assert_response_csp(
format!("/preview/{}", InscriptionId { txid, index: 0 }),
StatusCode::OK,
"default-src 'self'",
fs::read_to_string("templates/preview-unknown.html").unwrap(),
);
}
#[test]
fn video_preview() {
let server = TestServer::new_with_regtest();
server.mine_blocks(1);
let txid = server.bitcoin_rpc_server.broadcast_tx(TransactionTemplate {
inputs: &[(1, 0, 0, inscription("video/webm", "hello").to_witness())],
..Default::default()
});
let inscription_id = InscriptionId { txid, index: 0 };
server.mine_blocks(1);
server.assert_response_regex(
format!("/preview/{inscription_id}"),
StatusCode::OK,