[test] add middleware tests