---
title: "Comment by Mykolas Malaiška on \"The 2018 guide to writing (and testing) real world crowdsale contracts\" | Hashnode"
description: "Hello, An error occurred while testing Contract: HashnodeCrowdsale ✓ should deploy the token and store the address (97ms) ✓ should set stage to PreICO (109ms) 1"
url: "https://hashnode.com/posts/the-2018-guide-to-writing-and-testing-real-world-crowdsale-contracts/5a67bb65357c012503a334c9/comment/5aa057a80430f87244d40ca8"
---

[Discussion](https://hashnode.com/posts/the-2018-guide-to-writing-and-testing-real-world-crowdsale-contracts/5a67bb65357c012503a334c9)

Comment [The 2018 guide to writing (and testing) real world crowdsale contracts](https://hashnode.com/posts/the-2018-guide-to-writing-and-testing-real-world-crowdsale-contracts/5a67bb65357c012503a334c9)

[Mykolas Malaiška](https://hashnode.com/@Maiklas)

[Mar 7, 2018](https://hashnode.com/posts/the-2018-guide-to-writing-and-testing-real-world-crowdsale-contracts/5a67bb65357c012503a334c9/comment/5aa057a80430f87244d40ca8)

Hello,

An error occurred while testing

Contract: HashnodeCrowdsale ✓ should deploy the token and store the address (97ms) ✓ should set stage to PreICO (109ms) 1) one ETH should buy 5 Hashnode Tokens in PreICO

```
Events emitted during test:
---------------------------

Mint(to: <indexed>, amount: 5000000000000000000)
Transfer(from: <indexed>, to: <indexed>, value: 5000000000000000000)
TokenPurchase(purchaser: <indexed>, beneficiary: <indexed>, value: 1000000000000000000, amount: 5000000000000000000)
EthTransferred(text: forwarding funds to wallet)

---------------------------
✓ should transfer the ETH to wallet immediately in Pre ICO (572ms)
✓ should set variable `totalWeiRaisedDuringPreICO` correctly (41ms)
✓ should set stage to ICO (103ms)
2) one ETH should buy 2 Hashnode Tokens in ICO

Events emitted during test:
---------------------------

Mint(to: <indexed>, amount: 3000000000000000000)
Transfer(from: <indexed>, to: <indexed>, value: 3000000000000000000)
TokenPurchase(purchaser: <indexed>, beneficiary: <indexed>, value: 1500000000000000000, amount: 3000000000000000000)
EthTransferred(text: forwarding funds to refundable vault)

---------------------------
✓ should transfer the raised ETH to RefundVault during ICO (265ms)
✓ Vault balance should be added to our wallet once ICO is over (767ms)
```

7 passing (3s) 2 failing

1) Contract: HashnodeCrowdsale one ETH should buy 5 Hashnode Tokens in PreICO: Uncaught ReferenceError: HashnodeToken is not defined at test/TestCrowdsale.js:26:32 at <anonymous> at process.\_tickCallback (internal/process/next\_tick.js:188:7)

2) Contract: HashnodeCrowdsale one ETH should buy 2 Hashnode Tokens in ICO: Uncaught ReferenceError: HashnodeToken is not defined at test/TestCrowdsale.js:69:32 at <anonymous> at process.\_tickCallback (internal/process/next\_tick.js:188:7)

[Soubhik Ghorai](https://hashnode.com/@soubhik)

[Apr 3, 2018](https://hashnode.com/posts/the-2018-guide-to-writing-and-testing-real-world-crowdsale-contracts/5a67bb65357c012503a334c9/comment/5aa057a80430f87244d40ca8#reply-5ac326ab28aa3b76134f4fcb)

Any luck with this? I have the same issue and can't figure out what's wrong.
