Esempio n. 1
0
	. "github.com/onsi/gomega"
	"github.com/victor-castellanos/compz/dollars"
)

var _ = Describe("Snapshot", func() {

	var (
		snapshot Snapshot
	)

	Describe("Creating a Snapshot", func() {

		BeforeEach(func() {
			snapshot = Snapshot{
				Year:            1,
				TotalGrowth:     dollars.FromInt(20000),
				CurrentGrowth:   dollars.FromInt(10000),
				TotalInvested:   dollars.FromInt(30000),
				CurrentInvested: dollars.FromInt(25000),
			}
		})

		It("Should create the Snapshot with the correct year passed", func() {
			Expect(snapshot.Year).To(Equal(int32(1)))
		})

		It("Should create the Snapshot with the correct total growth", func() {
			Expect(snapshot.TotalGrowth).To(Equal(dollars.FromInt(20000)))
		})

		It("Should create the Snapshot with the correct year growth", func() {
Esempio n. 2
0
	"github.com/victor-castellanos/compz/dollars"
)

var _ = Describe("Investment", func() {
	var (
		sut     Investment
		account Account
	)

	Describe("Grow", func() {
		BeforeEach(func() {
			sut = Investment{
				InterestRate: 10,
			}
			account = sut.Grow(Account{
				Balance: dollars.FromInt(10000),
			})
		})

		It("should return an account with the growth balance", func() {
			Expect(account.Balance).To(Equal(dollars.FromInt(11000)))
			Expect(account.CapitalGain).To(Equal(dollars.FromInt(1000)))
		})

		Context("with periodic addition", func() {
			BeforeEach(func() {
				sut.Deposits = dollars.FromInt(10000)
			})

			Context("after multiple tics", func() {
				BeforeEach(func() {