์ ๋ํ ๊ธฐ๋ฅ์ด ์์ผ๋ฉด ํธ๋ฆฌํ ๊ฒ์ ๋๋ค.
spy.called(6).times // returns true if spy have been called 6 times
๋ด๊ฐ ์ฌ์ฉํ ์ ์๋ ๊ฒ๋ณด๋ค sinon-chai
spy.should.have.been.called(6).times
๋ฌผ๋ก spy.called
ํจ์ ํธ์ถ ์์ด ์ค๋์ฒ๋ผ ์๋ํด์ผ ํฉ๋๋ค.
spy.callCount
๋ฅผ ์ฌ์ฉํ์ฌ ํตํ ์๋ฅผ ํ์ธํฉ๋๋ค.
@cjohansen ๋ด๊ฐ ์ฌ์ฉํ๋ ์ด์ ๊ฐ spy.calledTwice
๋์ spy.callCount === 2
๋ ์ฝ์ ์ ์๊ธฐ ๋๋ฌธ์. (๋ํ ๊ทธ๊ฒ์ sinon-chai์ ์ ์ด์ธ๋ฆด ๊ฒ์
๋๋ค). ๋์ sinon-chai
repo์ ๋ฌธ์ ๋ฅผ ์ ์ถํด์ผ ํฉ๋๋ค.
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
spy.callCount
๋ฅผ ์ฌ์ฉํ์ฌ ํตํ ์๋ฅผ ํ์ธํฉ๋๋ค.