-
카테고리
-
세부 분야
블록체인
-
해결 여부
미해결
변수에서 오류가 납니다 ㅠㅠ
18.09.25 17:19 작성 조회수 105
0
** 매입자의 이름이 sejong이 아닙니다.
expected - actual
-sejng
+sejong
at testTestRealEstate.js:27:16
at process.tickCallback (internal/process/nexttick.js:68:7)
이라고 나오고요.. 강의 따라서 *
var RealEstate = artifacts.require("./RealEstate.sol");
contract('RealEstate', function(accounts){
var realEstateInstance;
it("컨트렉의 소유자 초기화 테스팅", function(){ return RealEstate.deployed().then(function(instance){
realEstateInstance = instance ;
return realEstateInstance.owner.call();
}).then(function(owner){
assert.equal(owner.toUpperCase(), accounts[0].toUpperCase(), "owner가 가나슈 첫번째 계정과 동일하지 않습니다.");
});
});
it("가나슈 두 번째 계정으로 매물 아이디 0번 매입 후 이벤트 생성 및 매입자 정보와 buyers 배열 테스팅", function() {
return RealEstate.deployed().then(function(instance){
realEstateInstance = instance;
return realEstateInstance.buyRealEstate(0, "sejong", 13, { from: accounts[1], value: web3.toWei(1.50,"ether")});
}).then(function(receipt){
assert.equal(receipt.logs.length, 1, "이벤트 하나가 생성되지 않았습니다.");
assert.equal(receipt.logs[0].event, "LogBuyRealEstate", "이벤트가 LogBuyRealEstate 아닙니다");
assert.equal(receipt.logs[0].args._buyer, accounts[1], "매입자가 가나슈 두번째 계정이 아닙니다.");
assert.equal(receipt.logs[0].args._id, 0, "매물 아이디가 0 이 아닙니다");
return realEstateInstance.getBuyerInfo(0);
}).then(function(buyerInfo){
assert.equal(buyerInfo[0].toUpperCase(), accounts[1].toUpperCase(),"매입자의 계정이 두번째 계정과 일치하지 않습니다");
assert.equal(web3.toAscii(buyerInfo[1]).replace(/o/g, ''), "sejong", "매입자의 이름이 sejong이 아닙니다.");
assert.equal(buyerInfo[2], 13, "매입자의 나이가 13이 아닙니다.");
return realEstateInstance.getAllBuyers();
}).then(function(buyers) {
assert.equal(buyers[0].toUpperCase(), accounts[1].toUpperCase(), "Buyers 배열 첫번째 인덱스의 계정이 가나슈 두번쨰 계정과 일치하지 않습니다");
})
})
});
답변을 작성해보세요.
0
SEJONG IT EDU
지식공유자2018.09.26
안녕하세요. 이 강의에 추가된 프로젝트 파일 다운받아보시고 실행해 보시겠어요? 실행이 성공적이라면은 한번 비교해보시면 될거같아요. 그래도 안돼면 코멘트 남겨주시구요.
답변 1