~singpolyma/sgx-jmp

ref: 358e8664769bdeef7c225e347d309c139ec51a69 sgx-jmp/test/test_web_register_manager.rb -rw-r--r-- 668 bytes
358e8664Stephen Paul Weber Merge branch 'finish-btc' 1 year, 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

require "test_helper"
require "web_register_manager"

class WebRegisterManagerTest < Minitest::Test
	def setup
		@manager = WebRegisterManager.new(redis: FakeRedis.new)
	end

	def test_set_get
		assert_kind_of WebRegisterManager::ChooseTel, @manager["jid@example.com"].sync
		@manager.set("jid@example.com", "+15555550000").sync
		assert_kind_of WebRegisterManager::HaveTel, @manager["jid@example.com"].sync
	end
	em :test_set_get

	def test_choose_tel_have_tel
		jid = "jid@example.com"
		@manager.set(jid, "+15555550000").sync
		assert_equal "+15555550000", @manager[jid].then(&:choose_tel).sync
	end
	em :test_choose_tel_have_tel
end