SHOWING: First 60
let info = server.index.info().unwrap();
assert_eq!(info.transactions.len(), 1);
assert_eq!(info.transactions[0].starting_block_count, 0);
server.index.update().unwrap();
assert_eq!(server.index.statistic(crate::index::Statistic::Commits), 1);
let info = server.index.info().unwrap();
assert_eq!(info.transactions.len(), 1);
assert_eq!(info.transactions[0].starting_block_count, 0);
server.mine_blocks(1);
thread::sleep(Duration::from_millis(10));
server.index.update().unwrap();
assert_eq!(server.index.statistic(crate::index::Statistic::Commits), 2);
let info = server.index.info().unwrap();
assert_eq!(info.transactions.len(), 2);
assert_eq!(info.transactions[0].starting_block_count, 0);
assert_eq!(info.transactions[1].starting_block_count, 1);
assert!(
info.transactions[1].starting_timestamp - info.transactions[0].starting_timestamp >= 10
);
}
#[test]
fn outputs_traversed_are_tracked() {
let server = TestServer::new_with_sat_index();#44,981,826text StatusCode::OK,
r".*<dt>sat</dt>\s*<dd><a href=/sat/5000000000>5000000000</a></dd>\s*<dt>preview</dt>.*",
);
}
#[test]
fn inscription_page_does_not_have_sat_when_sats_are_not_tracked() {
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_regex(
format!("/inscription/{}", InscriptionId { txid, index: 0 }),
StatusCode::OK,
r".*<dt>output value</dt>\s*<dd>5000000000</dd>\s*<dt>preview</dt>.*",
);
}
#[test]
fn strict_transport_security_header_is_set() {
assert_eq!(
TestServer::new()
.get("/status")
.headers()
.get(header::STRICT_TRANSPORT_SECURITY)
.unwrap(),
"max-age=31536000; includeSubDomains; preload",
);
}
#[test]
fn feed() {
let server = TestServer::new_with_regtest_with_index_sats();
#44,981,815text
#[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,#44,981,812text#!/usr/bin/env bash
set -euxo pipefail
systemctl stop ord-dev
rm -rf /var/lib/ord-dev
journalctl --unit ord-dev --rotate
journalctl --unit ord-dev --vacuum-time 1s
./bin/update-dev-server
#44,981,801text
server.assert_response_regex(
format!("/preview/{inscription_id}"),
StatusCode::OK,
format!(r".*<audio .*>\s*<source src=/content/{inscription_id}>.*"),
);
}
#[test]
fn font_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("font/ttf", "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,
format!(r".*src: url\(/content/{inscription_id}\).*"),
);
}
#[test]
fn pdf_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("application/pdf", "hello").to_witness(),#44,981,797text TestServer::new_with_sat_index().assert_response_regex(
"/sat/0",
StatusCode::OK,
".*>4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0:0<.*",
);
}
#[test]
fn dont_show_rare_txt_in_header_without_sat_index() {
TestServer::new().assert_response_regex(
"/",
StatusCode::OK,
".*
<a href=/clock title=clock>.*</a>
<a href=https://docs.ordinals.com/.*",
);
}
#[test]
fn input() {
TestServer::new().assert_response_regex(
"/input/0/0/0",
StatusCode::OK,
".*<title>Input /0/0/0</title>.*<h1>Input /0/0/0</h1>.*<dt>text</dt><dd>.*The Times 03/Jan/2009 Chancellor on brink of second bailout for banks</dd>.*",
);
}
#[test]
fn input_missing() {
TestServer::new().assert_response(
"/input/1/1/1",
StatusCode::NOT_FOUND,
"input /1/1/1 not found",
);
}
#[test]
fn commits_are_tracked() {
let server = TestServer::new();
thread::sleep(Duration::from_millis(100));
assert_eq!(server.index.statistic(crate::index::Statistic::Commits), 1);
#44,981,785text