summaryrefslogtreecommitdiff
path: root/test/test_server.rb
diff options
context:
space:
mode:
authorJunegunn Choi <junegunn.c@gmail.com>2025-01-27 02:08:52 +0900
committerJunegunn Choi <junegunn.c@gmail.com>2025-01-27 02:08:52 +0900
commit4b74f882c79600e4a988146d037eabf1fc484c7d (patch)
tree8d6322d85920ffe6dab22a3fd705f14abfb34031 /test/test_server.rb
parent7cf45af502c476e88e3cb20f37e936fec880320c (diff)
downloadfzf-4b74f882c79600e4a988146d037eabf1fc484c7d.tar.gz
[test] Prefer match_count over item_count
match_count can lag behind item_count and can cause intermittent failures.
Diffstat (limited to 'test/test_server.rb')
-rw-r--r--test/test_server.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/test_server.rb b/test/test_server.rb
index e30d50c9..1f019bca 100644
--- a/test/test_server.rb
+++ b/test/test_server.rb
@@ -9,7 +9,7 @@ class TestServer < TestInteractive
"--listen --sync --bind 'start:execute-silent:echo $FZF_PORT > /tmp/fzf-port'" =>
-> { URI("http://localhost:#{File.read('/tmp/fzf-port').chomp}") } }.each do |opts, fn|
tmux.send_keys "seq 10 | fzf #{opts}", :Enter
- tmux.until { |lines| assert_equal 10, lines.item_count }
+ tmux.until { |lines| assert_equal 10, lines.match_count }
state = JSON.parse(Net::HTTP.get(fn.call), symbolize_names: true)
assert_equal 10, state[:totalCount]
assert_equal 10, state[:matchCount]
@@ -33,7 +33,7 @@ class TestServer < TestInteractive
def test_listen_with_api_key
post_uri = URI('http://localhost:6266')
tmux.send_keys 'seq 10 | FZF_API_KEY=123abc fzf --listen 6266', :Enter
- tmux.until { |lines| assert_equal 10, lines.item_count }
+ tmux.until { |lines| assert_equal 10, lines.match_count }
# Incorrect API Key
[nil, { 'x-api-key' => '' }, { 'x-api-key' => '124abc' }].each do |headers|
res = Net::HTTP.post(post_uri, 'change-query(yo)+reload(seq 100)+change-prompt:hundred> ', headers)