describe check correct working extra games code function it check extr

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
describe("check correct working extra games code", function () {
it("check extra_game call on not extragame code", function (done) {
var localCase = prime({
gamestate_module: gamestate,
inherits: game_mock.GameTestCase,
_free_spin_stage: false,
_bank_on_start: 86046,
_tid: 0,
_holded_transaction: null,
_free_spin_counter: null,
CID: "794121211",
post_build: function () {
var math_module = new math.NewslotsMath()
math_module.free_spin_on_spin = true;
this.gsm.slot_machine._slot_machine = math_module;
this.amount = this._bank_on_start;
},
run: function(){
this.gsm.spin(this.requestSpin());
},
answer_message: function(answer){
expect(answer.service).toBe("answer");
switch (answer.event){
case "newslots_spinoff":
if (this._free_spin_stage == false){
this.check_spinoff(answer);
}
else {
this.check_freespinoff(answer);
}
break
}
},
check_freespinoff: function(msg){
expect(msg.id).toBe(""+this.ID);
expect(msg.args.CreditsOut).toBe(this.amount);
expect(msg.args.FreeSpinCount).toBe(this._free_spin_counter - 1);
this._free_spin_counter -= 1;
if (this._free_spin_counter == 0) {
return this.done();
}
this.next_free_spin();
},
check_spinoff: function(msg){
expect(msg.id).toBe(""+this.ID);
expect(msg.args.CreditsInter).toBe(this.amount);
expect(msg.args.FreeGamePrizes.length).toBe(5);
expect(msg.args.FreeSpinCount).toBe(5);
expect(msg.args.CurrentWin).toBe(0);
expect(msg.args.TotalWin).toBe(0);
this._free_spin_counter = msg.args.FreeSpinCount;
this._free_spin_stage = true;
this.next_free_spin();
},
next_free_spin: function(){
this.ID += 1;
var msg = new registry.games.FreeSpin({}, {id: ""+this.ID, uid: this.UID, cid: this.CID});
expect(msg.validate()).toBe(true);
this.gsm.free_spin(msg.data);
},
internal_message: function(req){
switch (req.event) {
case "commit":
this.transaction_commit(req);
break;
case "transaction":
this.transaction_hold(req);
break;
}
},
transaction_commit: function(msg){
var tid = null;
expect(msg.service).toBe("bank")
if (this._holded_transaction != null ){
expect(msg.args.tid).toBe(this._holded_transaction);
expect(msg.args.hold).toBe(25);
tid = this._holded_transaction;
} else {
this._tid += 1;
tid = ""+this._tid;
}
this.amount += msg.args.fund - msg.args.hold;
var resp = new registry.account.TransactionAnswer({
amount: this.amount,
tid: tid,
state: consts.transaction.STATE_FINISHED
}, msg);
expect(resp.validate()).toBe(true);
this.gsm.transaction_answer(resp.data);
},
transaction_hold: function(msg){
this._tid += 1;
expect(msg.service).toBe("bank")
expect(msg.args.hold).toBe(25);
var resp = new registry.account.TransactionAnswer({
amount: this.amount,
tid: ""+this._tid,
state: consts.transaction.STATE_STARTED
}, msg);
expect(resp.validate()).toBe(true);
this.gsm.transaction_answer(resp.data);
},
requestSpin: function(){
this.ID += 1;
var msg = new registry.games.Spin({
line: 5, bet: 5, denomination: 1
}, {uid: this.UID, cid: this.CID, id: ""+this.ID});
expect(msg.validate()).toBe(true);
msg = msg.data;
msg.service = "astirbike";
return msg;
}
});
var currentTest = new localCase(done);
currentTest.run();
});
});