How to use store0 method in wpt

Best JavaScript code snippet using wpt

CombatTask.test.js

Source:CombatTask.test.js Github

copy

Full Screen

1import AgentQueryType from "./AgentQueryType.js";2import CombatTask from "./CombatTask.js";3import TestData from "./TestData.js";4const { AttackDiceValue, DefenseDiceValue, Phase, Range } = XMA;5const { ActionCreator, Reducer } = XMS;6QUnit.module("CombatTask");7const addAttackDice = store => {8 const activeCombatId = XMS.Selector.activeCombatId(store.getState());9 const attackDice = Immutable([10 AttackDiceValue.BLANK,11 AttackDiceValue.FOCUS,12 AttackDiceValue.HIT,13 AttackDiceValue.CRITICAL_HIT14 ]);15 store.dispatch(ActionCreator.setCombatAttackDice(activeCombatId, attackDice));16};17const addCombatInstance = store => {18 const combatInstance = XMS.CombatState.create({19 id: 1,20 attackerId: 3,21 defenderId: 2,22 rangeKey: Range.TWO23 });24 store.dispatch(ActionCreator.setActiveCombatId(1));25 store.dispatch(ActionCreator.setCombatInstance(combatInstance));26};27const addDefenseDice = store => {28 const activeCombatId = XMS.Selector.activeCombatId(store.getState());29 const defenseDice = Immutable([30 DefenseDiceValue.BLANK,31 DefenseDiceValue.EVADE,32 DefenseDiceValue.FOCUS33 ]);34 store.dispatch(ActionCreator.setCombatDefenseDice(activeCombatId, defenseDice));35};36const initializeStore = () => {37 const store = Redux.createStore(Reducer.root, TestData.createGameState());38 return store;39};40const setPhase = (store, phaseKey) => store.dispatch(ActionCreator.setPhase(phaseKey));41const verifyActiveCombatId = (assert, store, expected, messagePrefix = "callback ") => {42 const activeCombatId = XMS.Selector.activeCombatId(store.getState());43 assert.equal(activeCombatId, expected, `${messagePrefix}activeCombatId`);44 assert.ok(45 XMS.Selector.combatInstance(activeCombatId, store.getState()),46 `${messagePrefix}combatInstance`47 );48};49const verifyActivePilotId = (assert, store, expected, messagePrefix = "callback ") =>50 assert.equal(store.getState().activePilotId, expected, `${messagePrefix}activePilotId`);51const verifyAgentQuery = (assert, store, expected, messagePrefix = "callback ") => {52 if (expected === undefined) {53 assert.equal(store.getState().agentQuery, expected, `${messagePrefix}agentQuery`);54 } else {55 const agentQuery = XMS.Selector.agentQuery(store.getState());56 assert.ok(agentQuery, `${messagePrefix}agentQuery`);57 assert.equal(agentQuery.queryKey, expected, `${messagePrefix}agentQuery.queryKey`);58 }59};60const verifyAgentResponse = (assert, store, expected, messagePrefix = "callback ") =>61 assert.equal(store.getState().agentResponse, expected, `${messagePrefix}agentResponse`);62const verifyAttackDiceKeys = (assert, store, expected, messagePrefix = "callback ") => {63 const { activeCombatId } = store.getState();64 const combatInstance = store.getState().combatInstances[activeCombatId];65 const { attackDiceKeys } = combatInstance;66 assert.ok(attackDiceKeys, `${messagePrefix}attackDiceKeys`);67 assert.equal(attackDiceKeys.length, expected, `${messagePrefix}attackDiceKeys.length`);68};69const verifyDefenseDiceKeys = (assert, store, expected, messagePrefix = "callback ") => {70 const { activeCombatId } = store.getState();71 const combatInstance = store.getState().combatInstances[activeCombatId];72 const { defenseDiceKeys } = combatInstance;73 assert.ok(defenseDiceKeys, `${messagePrefix}defenseDiceKeys`);74 assert.equal(defenseDiceKeys.length, expected, `${messagePrefix}defenseDiceKeys.length`);75};76const verifyCombatQueue = (assert, store, expected, messagePrefix = "callback ") => {77 const { combatQueue } = store.getState();78 assert.ok(combatQueue, `${messagePrefix}combatQueue`);79 assert.equal(combatQueue.length, expected.length, `${messagePrefix}combatQueue.length`);80 for (let i = 0; i < expected.length; i += 1) {81 assert.equal(combatQueue[i], expected[i], `${messagePrefix}combatQueue[${i}]`);82 }83};84const verifyPhaseKey = (assert, store, expected, messagePrefix = "callback ") =>85 assert.equal(store.getState().phaseKey, expected, `${messagePrefix}phaseKey`);86// /////////////////////////////////////////////////////////////////////////////////////////////////87QUnit.test("doIt() Start", assert => {88 // Setup.89 const store0 = initializeStore();90 store0.dispatch(ActionCreator.setPhase(Phase.COMBAT_START));91 // Run.92 const done = assert.async();93 const callback = store => {94 // Verify.95 assert.ok(true, "test resumed from async operation");96 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET);97 verifyCombatQueue(assert, store, [3, 1, 2]);98 verifyActivePilotId(assert, store, undefined);99 verifyAgentQuery(assert, store, undefined);100 verifyAgentResponse(assert, store, undefined);101 done();102 };103 CombatTask.doIt(store0).then(callback);104});105QUnit.test("doIt() Declare Target query", assert => {106 // Setup.107 const store0 = initializeStore();108 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));109 setPhase(store0, Phase.COMBAT_DECLARE_TARGET);110 verifyActivePilotId(assert, store0, undefined, "");111 // Run.112 const done = assert.async();113 const callback = store => {114 // Verify.115 assert.ok(true, "test resumed from async operation");116 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET);117 verifyCombatQueue(assert, store, [1, 2]);118 verifyActivePilotId(assert, store, 3);119 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER);120 verifyAgentResponse(assert, store, undefined);121 done();122 };123 CombatTask.doIt(store0).then(callback);124});125QUnit.test("doIt() Declare Target response", assert => {126 // Setup.127 const store0 = initializeStore();128 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));129 store0.dispatch(ActionCreator.dequeueCombat());130 const agentResponse = XMS.AgentResponseState.create({131 agentId: 2,132 responseKey: AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER,133 payload: {134 attackerId: 3,135 weaponKey: "primary",136 defenderId: 2137 }138 });139 store0.dispatch(ActionCreator.setAgentResponse(agentResponse));140 setPhase(store0, Phase.COMBAT_DECLARE_TARGET);141 verifyActivePilotId(assert, store0, 3, "");142 // Run.143 const done = assert.async();144 const callback = store => {145 // Verify.146 assert.ok(true, "test resumed from async operation");147 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_ATTACK_DICE);148 verifyCombatQueue(assert, store, [1, 2]);149 verifyActivePilotId(assert, store, 3);150 verifyAgentQuery(assert, store, undefined);151 verifyAgentResponse(assert, store, undefined);152 done();153 };154 CombatTask.doIt(store0).then(callback);155});156QUnit.test("doIt() Roll Attack Dice", assert => {157 // Setup.158 const store0 = initializeStore();159 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));160 store0.dispatch(ActionCreator.dequeueCombat());161 addCombatInstance(store0);162 setPhase(store0, Phase.COMBAT_ROLL_ATTACK_DICE);163 verifyActivePilotId(assert, store0, 3, "");164 // Run.165 const done = assert.async();166 const callback = store => {167 // Verify.168 assert.ok(true, "test resumed from async operation");169 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE);170 verifyCombatQueue(assert, store, [1, 2]);171 verifyActivePilotId(assert, store, 3, "");172 verifyAgentQuery(assert, store, undefined);173 verifyAgentResponse(assert, store, undefined);174 verifyActiveCombatId(assert, store, 1);175 verifyAttackDiceKeys(assert, store, 3);176 done();177 };178 CombatTask.doIt(store0).then(callback);179});180QUnit.test("doIt() Modify Attack Dice query", assert => {181 // Setup.182 const store0 = initializeStore();183 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));184 store0.dispatch(ActionCreator.dequeueCombat());185 addCombatInstance(store0);186 addAttackDice(store0);187 setPhase(store0, Phase.COMBAT_MODIFY_ATTACK_DICE);188 verifyActivePilotId(assert, store0, 3, "");189 // Run.190 const done = assert.async();191 const callback = store => {192 // Verify.193 assert.ok(true, "test resumed from async operation");194 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE);195 verifyCombatQueue(assert, store, [1, 2]);196 verifyActivePilotId(assert, store, 3);197 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION);198 verifyAgentResponse(assert, store, undefined);199 verifyActiveCombatId(assert, store, 1);200 verifyAttackDiceKeys(assert, store, 4);201 done();202 };203 CombatTask.doIt(store0).then(callback);204});205QUnit.test("doIt() Modify Attack Dice response", assert => {206 // Setup.207 const store0 = initializeStore();208 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));209 store0.dispatch(ActionCreator.dequeueCombat());210 addCombatInstance(store0);211 addAttackDice(store0);212 const agentResponse = XMS.AgentResponseState.create({213 agentId: 2,214 responseKey: AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION215 });216 store0.dispatch(ActionCreator.setAgentResponse(agentResponse));217 setPhase(store0, Phase.COMBAT_MODIFY_ATTACK_DICE);218 verifyActivePilotId(assert, store0, 3, "");219 // Run.220 const done = assert.async();221 const callback = store => {222 // Verify.223 assert.ok(true, "test resumed from async operation");224 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_DEFENSE_DICE);225 verifyCombatQueue(assert, store, [1, 2]);226 verifyActivePilotId(assert, store, 3);227 verifyAgentQuery(assert, store, undefined);228 verifyAgentResponse(assert, store, undefined);229 verifyActiveCombatId(assert, store, 1);230 verifyAttackDiceKeys(assert, store, 4);231 done();232 };233 CombatTask.doIt(store0).then(callback);234});235QUnit.test("doIt() Roll Defense Dice", assert => {236 const store0 = initializeStore();237 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));238 store0.dispatch(ActionCreator.dequeueCombat());239 addCombatInstance(store0);240 addAttackDice(store0);241 setPhase(store0, Phase.COMBAT_ROLL_DEFENSE_DICE);242 verifyActivePilotId(assert, store0, 3, "");243 // Run.244 const done = assert.async();245 const callback = store => {246 // Verify.247 assert.ok(true, "test resumed from async operation");248 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE);249 verifyCombatQueue(assert, store, [1, 2]);250 verifyActivePilotId(assert, store, 3, "");251 verifyAgentQuery(assert, store, undefined);252 verifyAgentResponse(assert, store, undefined);253 verifyActiveCombatId(assert, store, 1);254 verifyAttackDiceKeys(assert, store, 4);255 verifyDefenseDiceKeys(assert, store, 2);256 done();257 };258 CombatTask.doIt(store0).then(callback);259});260QUnit.test("doIt() Modify Defense Dice query", assert => {261 // Setup.262 const store0 = initializeStore();263 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));264 store0.dispatch(ActionCreator.dequeueCombat());265 addCombatInstance(store0);266 addAttackDice(store0);267 addDefenseDice(store0);268 setPhase(store0, Phase.COMBAT_MODIFY_DEFENSE_DICE);269 verifyActivePilotId(assert, store0, 3, "");270 // Run.271 const done = assert.async();272 const callback = store => {273 // Verify.274 assert.ok(true, "test resumed from async operation");275 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE);276 verifyCombatQueue(assert, store, [1, 2]);277 verifyActivePilotId(assert, store, 3);278 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION);279 verifyAgentResponse(assert, store, undefined);280 verifyActiveCombatId(assert, store, 1);281 verifyAttackDiceKeys(assert, store, 4);282 verifyDefenseDiceKeys(assert, store, 3);283 done();284 };285 CombatTask.doIt(store0).then(callback);286});287QUnit.test("doIt() Modify Defense Dice response", assert => {288 // Setup.289 const store0 = initializeStore();290 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));291 store0.dispatch(ActionCreator.dequeueCombat());292 addCombatInstance(store0);293 addAttackDice(store0);294 addDefenseDice(store0);295 const agentResponse = XMS.AgentResponseState.create({296 agentId: 2,297 responseKey: AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION298 });299 store0.dispatch(ActionCreator.setAgentResponse(agentResponse));300 setPhase(store0, Phase.COMBAT_MODIFY_DEFENSE_DICE);301 verifyActivePilotId(assert, store0, 3, "");302 // Run.303 const done = assert.async();304 const callback = store => {305 // Verify.306 assert.ok(true, "test resumed from async operation");307 verifyPhaseKey(assert, store, Phase.COMBAT_COMPARE_RESULTS);308 verifyCombatQueue(assert, store, [1, 2]);309 verifyActivePilotId(assert, store, 3);310 verifyAgentQuery(assert, store, undefined);311 verifyAgentResponse(assert, store, undefined);312 verifyActiveCombatId(assert, store, 1);313 verifyAttackDiceKeys(assert, store, 4);314 verifyDefenseDiceKeys(assert, store, 3);315 done();316 };317 CombatTask.doIt(store0).then(callback);318});319QUnit.test("doIt() Compare Results", assert => {320 const store0 = initializeStore();321 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));322 store0.dispatch(ActionCreator.dequeueCombat());323 addCombatInstance(store0);324 addAttackDice(store0);325 addDefenseDice(store0);326 setPhase(store0, Phase.COMBAT_COMPARE_RESULTS);327 verifyActivePilotId(assert, store0, 3, "");328 // Run.329 const done = assert.async();330 const callback = store => {331 // Verify.332 assert.ok(true, "test resumed from async operation");333 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE);334 verifyCombatQueue(assert, store, [1, 2]);335 verifyActivePilotId(assert, store, 3, "");336 verifyAgentQuery(assert, store, undefined);337 verifyAgentResponse(assert, store, undefined);338 verifyActiveCombatId(assert, store, 1);339 verifyAttackDiceKeys(assert, store, 4);340 verifyDefenseDiceKeys(assert, store, 3);341 const combatInstance = XMS.Selector.combatInstance(342 XMS.Selector.activeCombatId(store.getState()),343 store.getState()344 );345 assert.equal(combatInstance.shieldDamage, 0, "callback combatInstance.shieldDamage");346 assert.equal(combatInstance.hitDamage, 0, "callback combatInstance.hitDamage");347 assert.equal(combatInstance.criticalDamage, 1, "callback combatInstance.criticalDamage");348 done();349 };350 CombatTask.doIt(store0).then(callback);351});352QUnit.test("doIt() Notify Damage query", assert => {353 // Setup.354 const store0 = initializeStore();355 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));356 store0.dispatch(ActionCreator.dequeueCombat());357 addCombatInstance(store0);358 addAttackDice(store0);359 addDefenseDice(store0);360 setPhase(store0, Phase.COMBAT_NOTIFY_DAMAGE);361 verifyActivePilotId(assert, store0, 3, "");362 // Run.363 const done = assert.async();364 const callback = store => {365 // Verify.366 assert.ok(true, "test resumed from async operation");367 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE);368 verifyCombatQueue(assert, store, [1, 2]);369 verifyActivePilotId(assert, store, 3);370 verifyAgentQuery(assert, store, AgentQueryType.NOTIFY_DAMAGE);371 verifyAgentResponse(assert, store, undefined);372 verifyActiveCombatId(assert, store, 1);373 verifyAttackDiceKeys(assert, store, 4);374 verifyDefenseDiceKeys(assert, store, 3);375 done();376 };377 CombatTask.doIt(store0).then(callback);378});379QUnit.test("doIt() Modify Defense Dice response", assert => {380 // Setup.381 const store0 = initializeStore();382 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));383 store0.dispatch(ActionCreator.dequeueCombat());384 addCombatInstance(store0);385 addAttackDice(store0);386 addDefenseDice(store0);387 const agentResponse = XMS.AgentResponseState.create({388 agentId: 2,389 responseKey: AgentQueryType.NOTIFY_DAMAGE390 });391 store0.dispatch(ActionCreator.setAgentResponse(agentResponse));392 setPhase(store0, Phase.COMBAT_NOTIFY_DAMAGE);393 verifyActivePilotId(assert, store0, 3, "");394 // Run.395 const done = assert.async();396 const callback = store => {397 // Verify.398 assert.ok(true, "test resumed from async operation");399 verifyPhaseKey(assert, store, Phase.COMBAT_DEAL_DAMAGE);400 verifyCombatQueue(assert, store, [1, 2]);401 verifyActivePilotId(assert, store, 3);402 verifyAgentQuery(assert, store, undefined);403 verifyAgentResponse(assert, store, undefined);404 verifyActiveCombatId(assert, store, 1);405 verifyAttackDiceKeys(assert, store, 4);406 verifyDefenseDiceKeys(assert, store, 3);407 done();408 };409 CombatTask.doIt(store0).then(callback);410});411QUnit.test("doIt() Deal Damage", assert => {412 const store0 = initializeStore();413 store0.dispatch(ActionCreator.setCombatQueue([3, 1, 2]));414 store0.dispatch(ActionCreator.dequeueCombat());415 addCombatInstance(store0);416 addAttackDice(store0);417 addDefenseDice(store0);418 store0.dispatch(ActionCreator.setCombatShieldDamage(1, 0));419 store0.dispatch(ActionCreator.setCombatHitDamage(1, 0));420 store0.dispatch(ActionCreator.setCombatCriticalDamage(1, 1));421 setPhase(store0, Phase.COMBAT_DEAL_DAMAGE);422 verifyActivePilotId(assert, store0, 3, "");423 const combatInstance0 = XMS.Selector.combatInstance(424 XMS.Selector.activeCombatId(store0.getState()),425 store0.getState()426 );427 const defenderInstance0 = XMS.Selector.pilotInstance(428 combatInstance0.defenderId,429 store0.getState()430 );431 assert.equal(defenderInstance0.damages.length, 1, "pilot damages");432 assert.equal(defenderInstance0.criticals.length, 1, "pilot criticals");433 // Run.434 const done = assert.async();435 const callback = store => {436 // Verify.437 assert.ok(true, "test resumed from async operation");438 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET);439 verifyCombatQueue(assert, store, [1, 2]);440 verifyActivePilotId(assert, store, 3, "");441 verifyAgentQuery(assert, store, undefined);442 verifyAgentResponse(assert, store, undefined);443 verifyActiveCombatId(assert, store, 1);444 verifyAttackDiceKeys(assert, store, 4);445 verifyDefenseDiceKeys(assert, store, 3);446 const combatInstance = XMS.Selector.combatInstance(447 XMS.Selector.activeCombatId(store.getState()),448 store.getState()449 );450 assert.equal(combatInstance.shieldDamage, 0, "callback combatInstance.shieldDamage");451 assert.equal(combatInstance.hitDamage, 0, "callback combatInstance.hitDamage");452 assert.equal(combatInstance.criticalDamage, 1, "callback combatInstance.criticalDamage");453 const defenderInstance = XMS.Selector.pilotInstance(454 combatInstance.defenderId,455 store.getState()456 );457 assert.equal(defenderInstance.damages.length, 1, "callback pilot damages");458 assert.equal(defenderInstance.criticals.length, 2, "callback pilot criticals");459 done();460 };461 CombatTask.doIt(store0).then(callback);462});463QUnit.test("doIt() End", assert => {464 // Setup.465 const store0 = initializeStore();466 setPhase(store0, Phase.COMBAT_END);467 // Run.468 const done = assert.async();469 const callback = store => {470 // Verify.471 assert.ok(true, "test resumed from async operation");472 verifyPhaseKey(assert, store, Phase.END_START);473 verifyCombatQueue(assert, store, []);474 verifyActivePilotId(assert, store, undefined, "");475 verifyAgentQuery(assert, store, undefined);476 verifyAgentResponse(assert, store, undefined);477 done();478 };479 CombatTask.doIt(store0).then(callback);480});481QUnit.test("doIt() Full Cycle", assert => {482 // Setup.483 const store0 = initializeStore();484 store0.dispatch(ActionCreator.setPhase(Phase.COMBAT_START));485 // Run.486 const done = assert.async();487 const callback38 = store => {488 // Verify.489 verifyPhaseKey(assert, store, Phase.COMBAT_END, "callback38 ");490 verifyCombatQueue(assert, store, [], "callback38 ");491 verifyAgentQuery(assert, store, undefined, "callback38 ");492 verifyAgentResponse(assert, store, undefined, "callback38 ");493 done();494 };495 const callback37 = store => {496 // Verify.497 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback37 ");498 verifyCombatQueue(assert, store, [], "callback37 ");499 verifyAgentQuery(assert, store, undefined, "callback37 ");500 verifyAgentResponse(assert, store, undefined, "callback37 ");501 CombatTask.doIt(store).then(callback38);502 };503 const callback36 = store => {504 // Verify.505 verifyPhaseKey(assert, store, Phase.COMBAT_DEAL_DAMAGE, "callback36 ");506 verifyCombatQueue(assert, store, [], "callback36 ");507 verifyAgentQuery(assert, store, undefined, "callback36 ");508 verifyAgentResponse(assert, store, undefined, "callback36 ");509 CombatTask.doIt(store).then(callback37);510 };511 const callback35 = store => {512 // Verify.513 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE, "callback35 ");514 verifyCombatQueue(assert, store, [], "callback35 ");515 verifyAgentQuery(assert, store, AgentQueryType.NOTIFY_DAMAGE, "callback35 ");516 const agentQuery = XMS.Selector.agentQuery(store.getState());517 const agentResponse = XMS.AgentResponseState.create({518 agentId: agentQuery.agentId,519 responseKey: AgentQueryType.NOTIFY_DAMAGE,520 payload: {}521 });522 store.dispatch(ActionCreator.clearAgentQuery());523 store.dispatch(ActionCreator.setAgentResponse(agentResponse));524 CombatTask.doIt(store).then(callback36);525 };526 const callback34 = store => {527 // Verify.528 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE, "callback34 ");529 verifyCombatQueue(assert, store, [], "callback34 ");530 verifyAgentQuery(assert, store, undefined, "callback34 ");531 verifyAgentResponse(assert, store, undefined, "callback34 ");532 CombatTask.doIt(store).then(callback35);533 };534 const callback33 = store => {535 // Verify.536 verifyPhaseKey(assert, store, Phase.COMBAT_COMPARE_RESULTS, "callback33 ");537 verifyCombatQueue(assert, store, [], "callback33 ");538 verifyAgentQuery(assert, store, undefined, "callback33 ");539 verifyAgentResponse(assert, store, undefined, "callback33 ");540 CombatTask.doIt(store).then(callback34);541 };542 const callback32 = store => {543 // Verify.544 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE, "callback32 ");545 verifyCombatQueue(assert, store, [], "callback32 ");546 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION, "callback32 ");547 const agentQuery = XMS.Selector.agentQuery(store.getState());548 const agentResponse = XMS.AgentResponseState.create({549 agentId: agentQuery.agentId,550 responseKey: AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION,551 payload: {}552 });553 store.dispatch(ActionCreator.clearAgentQuery());554 store.dispatch(ActionCreator.setAgentResponse(agentResponse));555 CombatTask.doIt(store).then(callback33);556 };557 const callback31 = store => {558 // Verify.559 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE, "callback31 ");560 verifyCombatQueue(assert, store, [], "callback31 ");561 verifyAgentQuery(assert, store, undefined, "callback31 ");562 verifyAgentResponse(assert, store, undefined, "callback31 ");563 CombatTask.doIt(store).then(callback32);564 };565 const callback30 = store => {566 // Verify.567 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_DEFENSE_DICE, "callback30 ");568 verifyCombatQueue(assert, store, [], "callback30 ");569 verifyAgentQuery(assert, store, undefined, "callback30 ");570 verifyAgentResponse(assert, store, undefined, "callback30 ");571 CombatTask.doIt(store).then(callback31);572 };573 const callback29 = store => {574 // Verify.575 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE, "callback29 ");576 verifyCombatQueue(assert, store, [], "callback29 ");577 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION, "callback29 ");578 const agentQuery = XMS.Selector.agentQuery(store.getState());579 const agentResponse = XMS.AgentResponseState.create({580 agentId: agentQuery.agentId,581 responseKey: AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION,582 payload: {}583 });584 store.dispatch(ActionCreator.clearAgentQuery());585 store.dispatch(ActionCreator.setAgentResponse(agentResponse));586 CombatTask.doIt(store).then(callback30);587 };588 const callback28 = store => {589 // Verify.590 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE, "callback28 ");591 verifyCombatQueue(assert, store, [], "callback28 ");592 verifyAgentQuery(assert, store, undefined, "callback28 ");593 verifyAgentResponse(assert, store, undefined, "callback28 ");594 CombatTask.doIt(store).then(callback29);595 };596 const callback27 = store => {597 // Verify.598 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_ATTACK_DICE, "callback27 ");599 verifyCombatQueue(assert, store, [], "callback27 ");600 verifyAgentQuery(assert, store, undefined, "callback27 ");601 verifyAgentResponse(assert, store, undefined, "callback27 ");602 CombatTask.doIt(store).then(callback28);603 };604 const callback26 = store => {605 // Verify.606 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback26 ");607 verifyCombatQueue(assert, store, [], "callback26 ");608 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER, "callback26 ");609 const agentQuery = XMS.Selector.agentQuery(store.getState());610 const agentResponse = XMS.AgentResponseState.create({611 agentId: agentQuery.agentId,612 responseKey: AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER,613 payload: {614 defenderId: 3,615 attackerId: agentQuery.payload.attackerId,616 rangeKey: Range.TWO,617 weaponKey: "primary"618 }619 });620 store.dispatch(ActionCreator.clearAgentQuery());621 store.dispatch(ActionCreator.setAgentResponse(agentResponse));622 CombatTask.doIt(store).then(callback27);623 };624 const callback25 = store => {625 // Verify.626 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback25 ");627 verifyCombatQueue(assert, store, [2], "callback25 ");628 verifyAgentQuery(assert, store, undefined, "callback25 ");629 verifyAgentResponse(assert, store, undefined, "callback25 ");630 CombatTask.doIt(store).then(callback26);631 };632 const callback24 = store => {633 // Verify.634 verifyPhaseKey(assert, store, Phase.COMBAT_DEAL_DAMAGE, "callback24 ");635 verifyCombatQueue(assert, store, [2], "callback24 ");636 verifyAgentQuery(assert, store, undefined, "callback24 ");637 verifyAgentResponse(assert, store, undefined, "callback24 ");638 CombatTask.doIt(store).then(callback25);639 };640 const callback23 = store => {641 // Verify.642 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE, "callback23 ");643 verifyCombatQueue(assert, store, [2], "callback23 ");644 verifyAgentQuery(assert, store, AgentQueryType.NOTIFY_DAMAGE, "callback23 ");645 const agentQuery = XMS.Selector.agentQuery(store.getState());646 const agentResponse = XMS.AgentResponseState.create({647 agentId: agentQuery.agentId,648 responseKey: AgentQueryType.NOTIFY_DAMAGE,649 payload: {}650 });651 store.dispatch(ActionCreator.clearAgentQuery());652 store.dispatch(ActionCreator.setAgentResponse(agentResponse));653 CombatTask.doIt(store).then(callback24);654 };655 const callback22 = store => {656 // Verify.657 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE, "callback22 ");658 verifyCombatQueue(assert, store, [2], "callback22 ");659 verifyAgentQuery(assert, store, undefined, "callback22 ");660 verifyAgentResponse(assert, store, undefined, "callback22 ");661 CombatTask.doIt(store).then(callback23);662 };663 const callback21 = store => {664 // Verify.665 verifyPhaseKey(assert, store, Phase.COMBAT_COMPARE_RESULTS, "callback21 ");666 verifyCombatQueue(assert, store, [2], "callback21 ");667 verifyAgentQuery(assert, store, undefined, "callback21 ");668 verifyAgentResponse(assert, store, undefined, "callback21 ");669 CombatTask.doIt(store).then(callback22);670 };671 const callback20 = store => {672 // Verify.673 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE, "callback20 ");674 verifyCombatQueue(assert, store, [2], "callback20 ");675 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION, "callback20 ");676 const agentQuery = XMS.Selector.agentQuery(store.getState());677 const agentResponse = XMS.AgentResponseState.create({678 agentId: agentQuery.agentId,679 responseKey: AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION,680 payload: {}681 });682 store.dispatch(ActionCreator.clearAgentQuery());683 store.dispatch(ActionCreator.setAgentResponse(agentResponse));684 CombatTask.doIt(store).then(callback21);685 };686 const callback19 = store => {687 // Verify.688 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE, "callback19 ");689 verifyCombatQueue(assert, store, [2], "callback19 ");690 verifyAgentQuery(assert, store, undefined, "callback19 ");691 verifyAgentResponse(assert, store, undefined, "callback19 ");692 CombatTask.doIt(store).then(callback20);693 };694 const callback18 = store => {695 // Verify.696 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_DEFENSE_DICE, "callback18 ");697 verifyCombatQueue(assert, store, [2], "callback18 ");698 verifyAgentQuery(assert, store, undefined, "callback18 ");699 verifyAgentResponse(assert, store, undefined, "callback18 ");700 CombatTask.doIt(store).then(callback19);701 };702 const callback17 = store => {703 // Verify.704 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE, "callback17 ");705 verifyCombatQueue(assert, store, [2], "callback17 ");706 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION, "callback17 ");707 const agentQuery = XMS.Selector.agentQuery(store.getState());708 const agentResponse = XMS.AgentResponseState.create({709 agentId: agentQuery.agentId,710 responseKey: AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION,711 payload: {}712 });713 store.dispatch(ActionCreator.clearAgentQuery());714 store.dispatch(ActionCreator.setAgentResponse(agentResponse));715 CombatTask.doIt(store).then(callback18);716 };717 const callback16 = store => {718 // Verify.719 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE, "callback16 ");720 verifyCombatQueue(assert, store, [2], "callback16 ");721 verifyAgentQuery(assert, store, undefined, "callback16 ");722 verifyAgentResponse(assert, store, undefined, "callback16 ");723 CombatTask.doIt(store).then(callback17);724 };725 const callback15 = store => {726 // Verify.727 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_ATTACK_DICE, "callback15 ");728 verifyCombatQueue(assert, store, [2], "callback15 ");729 verifyAgentQuery(assert, store, undefined, "callback15 ");730 verifyAgentResponse(assert, store, undefined, "callback15 ");731 CombatTask.doIt(store).then(callback16);732 };733 const callback14 = store => {734 // Verify.735 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback14 ");736 verifyCombatQueue(assert, store, [2], "callback14 ");737 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER, "callback14 ");738 const agentQuery = XMS.Selector.agentQuery(store.getState());739 const agentResponse = XMS.AgentResponseState.create({740 agentId: agentQuery.agentId,741 responseKey: AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER,742 payload: {743 defenderId: 3,744 attackerId: agentQuery.payload.attackerId,745 rangeKey: Range.TWO,746 weaponKey: "primary"747 }748 });749 store.dispatch(ActionCreator.clearAgentQuery());750 store.dispatch(ActionCreator.setAgentResponse(agentResponse));751 CombatTask.doIt(store).then(callback15);752 };753 const callback13 = store => {754 // Verify.755 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback13 ");756 verifyCombatQueue(assert, store, [1, 2], "callback13 ");757 verifyAgentQuery(assert, store, undefined, "callback13 ");758 verifyAgentResponse(assert, store, undefined, "callback13 ");759 CombatTask.doIt(store).then(callback14);760 };761 const callback12 = store => {762 // Verify.763 verifyPhaseKey(assert, store, Phase.COMBAT_DEAL_DAMAGE, "callback12 ");764 verifyCombatQueue(assert, store, [1, 2], "callback12 ");765 verifyAgentQuery(assert, store, undefined, "callback12 ");766 verifyAgentResponse(assert, store, undefined, "callback12 ");767 CombatTask.doIt(store).then(callback13);768 };769 const callback11 = store => {770 // Verify.771 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE, "callback11 ");772 verifyCombatQueue(assert, store, [1, 2], "callback11 ");773 verifyAgentQuery(assert, store, AgentQueryType.NOTIFY_DAMAGE, "callback11 ");774 const agentQuery = XMS.Selector.agentQuery(store.getState());775 const agentResponse = XMS.AgentResponseState.create({776 agentId: agentQuery.agentId,777 responseKey: AgentQueryType.NOTIFY_DAMAGE,778 payload: {}779 });780 store.dispatch(ActionCreator.clearAgentQuery());781 store.dispatch(ActionCreator.setAgentResponse(agentResponse));782 CombatTask.doIt(store).then(callback12);783 };784 const callback10 = store => {785 // Verify.786 verifyPhaseKey(assert, store, Phase.COMBAT_NOTIFY_DAMAGE, "callback10 ");787 verifyCombatQueue(assert, store, [1, 2], "callback10 ");788 verifyAgentQuery(assert, store, undefined, "callback10 ");789 verifyAgentResponse(assert, store, undefined, "callback10 ");790 CombatTask.doIt(store).then(callback11);791 };792 const callback09 = store => {793 // Verify.794 verifyPhaseKey(assert, store, Phase.COMBAT_COMPARE_RESULTS, "callback09 ");795 verifyCombatQueue(assert, store, [1, 2], "callback09 ");796 verifyAgentQuery(assert, store, undefined, "callback09 ");797 verifyAgentResponse(assert, store, undefined, "callback09 ");798 CombatTask.doIt(store).then(callback10);799 };800 const callback08 = store => {801 // Verify.802 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE, "callback08 ");803 verifyCombatQueue(assert, store, [1, 2], "callback08 ");804 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION, "callback08 ");805 const agentQuery = XMS.Selector.agentQuery(store.getState());806 const agentResponse = XMS.AgentResponseState.create({807 agentId: agentQuery.agentId,808 responseKey: AgentQueryType.CHOOSE_DEFENSE_DICE_MODIFICATION,809 payload: {}810 });811 store.dispatch(ActionCreator.clearAgentQuery());812 store.dispatch(ActionCreator.setAgentResponse(agentResponse));813 CombatTask.doIt(store).then(callback09);814 };815 const callback07 = store => {816 // Verify.817 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_DEFENSE_DICE, "callback07 ");818 verifyCombatQueue(assert, store, [1, 2], "callback07 ");819 verifyAgentQuery(assert, store, undefined, "callback07 ");820 verifyAgentResponse(assert, store, undefined, "callback07 ");821 CombatTask.doIt(store).then(callback08);822 };823 const callback06 = store => {824 // Verify.825 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_DEFENSE_DICE, "callback06 ");826 verifyCombatQueue(assert, store, [1, 2], "callback06 ");827 verifyAgentQuery(assert, store, undefined, "callback06 ");828 verifyAgentResponse(assert, store, undefined, "callback06 ");829 CombatTask.doIt(store).then(callback07);830 };831 const callback05 = store => {832 // Verify.833 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE, "callback05 ");834 verifyCombatQueue(assert, store, [1, 2], "callback05 ");835 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION, "callback05 ");836 const agentQuery = XMS.Selector.agentQuery(store.getState());837 const agentResponse = XMS.AgentResponseState.create({838 agentId: agentQuery.agentId,839 responseKey: AgentQueryType.CHOOSE_ATTACK_DICE_MODIFICATION,840 payload: {}841 });842 store.dispatch(ActionCreator.clearAgentQuery());843 store.dispatch(ActionCreator.setAgentResponse(agentResponse));844 CombatTask.doIt(store).then(callback06);845 };846 const callback04 = store => {847 // Verify.848 verifyPhaseKey(assert, store, Phase.COMBAT_MODIFY_ATTACK_DICE, "callback04 ");849 verifyCombatQueue(assert, store, [1, 2], "callback04 ");850 verifyAgentQuery(assert, store, undefined, "callback04 ");851 verifyAgentResponse(assert, store, undefined, "callback04 ");852 CombatTask.doIt(store).then(callback05);853 };854 const callback03 = store => {855 // Verify.856 verifyPhaseKey(assert, store, Phase.COMBAT_ROLL_ATTACK_DICE, "callback03 ");857 verifyCombatQueue(assert, store, [1, 2], "callback03 ");858 verifyAgentQuery(assert, store, undefined, "callback03 ");859 verifyAgentResponse(assert, store, undefined, "callback03 ");860 CombatTask.doIt(store).then(callback04);861 };862 const callback02 = store => {863 // Verify.864 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback02 ");865 verifyCombatQueue(assert, store, [1, 2], "callback02 ");866 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER, "callback02 ");867 const agentQuery = XMS.Selector.agentQuery(store.getState());868 const agentResponse = XMS.AgentResponseState.create({869 agentId: agentQuery.agentId,870 responseKey: AgentQueryType.CHOOSE_WEAPON_AND_DEFENDER,871 payload: {872 defenderId: 2,873 attackerId: agentQuery.payload.attackerId,874 rangeKey: Range.TWO,875 weaponKey: "primary"876 }877 });878 store.dispatch(ActionCreator.clearAgentQuery());879 store.dispatch(ActionCreator.setAgentResponse(agentResponse));880 CombatTask.doIt(store).then(callback03);881 };882 const callback01 = store => {883 // Verify.884 verifyPhaseKey(assert, store, Phase.COMBAT_DECLARE_TARGET, "callback01 ");885 verifyCombatQueue(assert, store, [3, 1, 2], "callback01 ");886 verifyAgentQuery(assert, store, undefined, "callback01 ");887 verifyAgentResponse(assert, store, undefined, "callback01 ");888 CombatTask.doIt(store).then(callback02);889 };890 CombatTask.doIt(store0).then(callback01);891});892const CombatTaskTest = {};...

Full Screen

Full Screen

dashboard.component.ts

Source:dashboard.component.ts Github

copy

Full Screen

1import { Component, OnInit } from '@angular/core';2import { StoreService } from 'src/app/Services/store.service';3import * as Chartist from 'chartist';4import { ActivatedRoute, Router } from '@angular/router';5import { HttpClient } from '@angular/common/http';6import { environment } from 'src/environments/environment';7import { Store } from '../Models/store.model';8import { Historique } from '../Models/historique.model';9@Component({10 selector: 'app-dashboard',11 templateUrl: './dashboard.component.html',12 styleUrls: ['./dashboard.component.css']13})14export class DashboardComponent2 implements OnInit {15 store0: Store16 listeStore0: Store[] = [];17 historique3: Historique;18 listhist3: Historique[] = [];19 commercantnumber: number20 nbrClientParJour0: number21 revenuCeJour: number = 022 nbrClientParJour1: number23 nbrClientParJour2: number24 nbrClientParJour3: number25 nbrClientParJour4: number26 nbrClientParJour5: number27 nbrClientParJour6: number28 listeNbrTransaction: number[] = [];29 listeSommeParJour: number[] = [];30 max: number = 031 min: number = 032 maxS: number = 033 minS: number = 034 readonly rootURL = environment.apiURL+"/"35 constructor(private service: StoreService, private route: ActivatedRoute, private router: Router, private http: HttpClient) {36 this.route.queryParams.subscribe(params => {37 this.commercantnumber = params.idc;38 console.log('id:' + this.commercantnumber); // popular39 })40 }41 startAnimationForLineChart(chart) {42 let seq: any, delays: any, durations: any;43 seq = 0;44 delays = 80;45 durations = 500;46 chart.on('draw', function (data) {47 if (data.type === 'line' || data.type === 'area') {48 data.element.animate({49 d: {50 begin: 600,51 dur: 700,52 from: data.path.clone().scale(1, 0).translate(0, data.chartRect.height()).stringify(),53 to: data.path.clone().stringify(),54 easing: Chartist.Svg.Easing.easeOutQuint55 }56 });57 } else if (data.type === 'point') {58 seq++;59 data.element.animate({60 opacity: {61 begin: seq * delays,62 dur: durations,63 from: 0,64 to: 1,65 easing: 'ease'66 }67 });68 }69 });70 seq = 0;71 };72 startAnimationForBarChart(chart) {73 let seq2: any, delays2: any, durations2: any;74 seq2 = 0;75 delays2 = 80;76 durations2 = 500;77 chart.on('draw', function (data) {78 if (data.type === 'bar') {79 seq2++;80 data.element.animate({81 opacity: {82 begin: seq2 * delays2,83 dur: durations2,84 from: 0,85 to: 1,86 easing: 'ease'87 }88 });89 }90 });91 seq2 = 0;92 };93 ngOnInit() {94 this.service.getallStoresbyid(this.commercantnumber);95 this.service.getSolde(this.commercantnumber);96 this.service.getNumberOfStores(this.commercantnumber)97 this.service.getNumberOfTransactions(this.commercantnumber)98 this.service.getLastTransactions(this.commercantnumber)99 this.http.get(this.rootURL + 'commandes0/').subscribe(resp2 => {100 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {101 this.listhist3 = [];102 this.listeStore0 = [];103 for (var i = 0; i < Number(resp3['length']); i++) {104 // @ts-ignore105 this.store0 = {106 StoreID: null,107 nom: ''108 }109 this.store0.StoreID = resp3[i]["id"];110 this.store0.nom = resp3[i]["nom"];111 this.store0.Commercant = resp3[i]["Commercant"];112 this.listeStore0.push(this.store0);113 }114 this.revenuCeJour = 0115 for (var i = 0; i < Number(resp2['length']); i++) {116 // @ts-ignore117 this.historique3 = {118 enfant: null,119 store: null,120 prixcommande: 0,121 dateachat: null122 }123 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);124 this.historique3.prixcommande = (resp2[i]["prixTotal"]);125 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;126 for (var j = 0; j < this.listeStore0.length; j++) {127 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {128 this.historique3.store = this.listeStore0[j]129 }130 }131 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {132 this.listhist3.push(this.historique3);133 }134 }135 //console.log(this.listhist3, "thiiiiiiiisss");136 this.nbrClientParJour0 = 0;137 this.nbrClientParJour0 = this.listhist3.length;138 this.listeNbrTransaction.push(this.nbrClientParJour0)139 this.listeSommeParJour.push(this.revenuCeJour)140 //////////////////////////////////////////////////////////////////////////////////////////////141 this.http.get(this.rootURL + 'commandes1/').subscribe(resp2 => {142 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {143 this.listhist3 = [];144 this.listeStore0 = [];145 for (var i = 0; i < Number(resp3['length']); i++) {146 // @ts-ignore147 this.store0 = {148 StoreID: null,149 nom: ''150 }151 this.store0.StoreID = resp3[i]["id"];152 this.store0.nom = resp3[i]["nom"];153 this.store0.Commercant = resp3[i]["Commercant"];154 this.listeStore0.push(this.store0);155 }156 this.revenuCeJour = 0157 for (var i = 0; i < Number(resp2['length']); i++) {158 // @ts-ignore159 this.historique3 = {160 enfant: null,161 store: null,162 prixcommande: 0,163 dateachat: null164 }165 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);166 this.historique3.prixcommande = (resp2[i]["prixTotal"]);167 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;168 for (var j = 0; j < this.listeStore0.length; j++) {169 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {170 this.historique3.store = this.listeStore0[j]171 }172 }173 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {174 this.listhist3.push(this.historique3);175 }176 }177 console.log(this.listhist3, "thiiiiiiiisss");178 this.nbrClientParJour1 = 0;179 this.nbrClientParJour1 = this.listhist3.length;180 this.listeNbrTransaction.push(this.nbrClientParJour1)181 this.listeSommeParJour.push(this.revenuCeJour)182 //////////////////////////////////////////////////////////////////////////////////////////////183 this.http.get(this.rootURL + 'commandes2/').subscribe(resp2 => {184 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {185 this.listhist3 = [];186 this.listeStore0 = [];187 for (var i = 0; i < Number(resp3['length']); i++) {188 // @ts-ignore189 this.store0 = {190 StoreID: null,191 nom: ''192 }193 this.store0.StoreID = resp3[i]["id"];194 this.store0.nom = resp3[i]["nom"];195 this.store0.Commercant = resp3[i]["Commercant"];196 this.listeStore0.push(this.store0);197 }198 this.revenuCeJour = 0199 for (var i = 0; i < Number(resp2['length']); i++) {200 // @ts-ignore201 this.historique3 = {202 enfant: null,203 store: null,204 prixcommande: 0,205 dateachat: null206 }207 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);208 this.historique3.prixcommande = (resp2[i]["prixTotal"]);209 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;210 for (var j = 0; j < this.listeStore0.length; j++) {211 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {212 this.historique3.store = this.listeStore0[j]213 }214 }215 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {216 this.listhist3.push(this.historique3);217 }218 }219 console.log(this.listhist3, "thiiiiiiiisss");220 this.nbrClientParJour2 = 0;221 this.nbrClientParJour2 = this.listhist3.length;222 this.listeNbrTransaction.push(this.nbrClientParJour2)223 this.listeSommeParJour.push(this.revenuCeJour)224 //////////////////////////////////////////////////////////////////////////////////////////////225 this.http.get(this.rootURL + 'commandes3/').subscribe(resp2 => {226 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {227 this.listhist3 = [];228 this.listeStore0 = [];229 for (var i = 0; i < Number(resp3['length']); i++) {230 // @ts-ignore231 this.store0 = {232 StoreID: null,233 nom: ''234 }235 this.store0.StoreID = resp3[i]["id"];236 this.store0.nom = resp3[i]["nom"];237 this.store0.Commercant = resp3[i]["Commercant"];238 this.listeStore0.push(this.store0);239 }240 this.revenuCeJour = 0241 for (var i = 0; i < Number(resp2['length']); i++) {242 // @ts-ignore243 this.historique3 = {244 enfant: null,245 store: null,246 prixcommande: 0,247 dateachat: null248 }249 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);250 this.historique3.prixcommande = (resp2[i]["prixTotal"]);251 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;252 for (var j = 0; j < this.listeStore0.length; j++) {253 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {254 this.historique3.store = this.listeStore0[j]255 }256 }257 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {258 this.listhist3.push(this.historique3);259 }260 }261 console.log(this.listhist3, "thiiiiiiiisss");262 this.nbrClientParJour3 = 0;263 this.nbrClientParJour3 = this.listhist3.length;264 this.listeNbrTransaction.push(this.nbrClientParJour3)265 this.listeSommeParJour.push(this.revenuCeJour)266 //////////////////////////////////////////////////////////////////////////////////////////////267 this.http.get(this.rootURL + 'commandes4/').subscribe(resp2 => {268 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {269 this.listhist3 = [];270 this.listeStore0 = [];271 for (var i = 0; i < Number(resp3['length']); i++) {272 // @ts-ignore273 this.store0 = {274 StoreID: null,275 nom: ''276 }277 this.store0.StoreID = resp3[i]["id"];278 this.store0.nom = resp3[i]["nom"];279 this.store0.Commercant = resp3[i]["Commercant"];280 this.listeStore0.push(this.store0);281 }282 this.revenuCeJour = 0283 for (var i = 0; i < Number(resp2['length']); i++) {284 // @ts-ignore285 this.historique3 = {286 enfant: null,287 store: null,288 prixcommande: 0,289 dateachat: null290 }291 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);292 this.historique3.prixcommande = (resp2[i]["prixTotal"]);293 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;294 for (var j = 0; j < this.listeStore0.length; j++) {295 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {296 this.historique3.store = this.listeStore0[j]297 }298 }299 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {300 this.listhist3.push(this.historique3);301 }302 }303 console.log(this.listhist3, "thiiiiiiiisss");304 this.nbrClientParJour4 = 0;305 this.nbrClientParJour4 = this.listhist3.length;306 this.listeNbrTransaction.push(this.nbrClientParJour4)307 this.listeSommeParJour.push(this.revenuCeJour)308 //////////////////////////////////////////////////////////////////////////////////////////////309 this.http.get(this.rootURL + 'commandes5/').subscribe(resp2 => {310 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {311 this.listhist3 = [];312 this.listeStore0 = [];313 for (var i = 0; i < Number(resp3['length']); i++) {314 // @ts-ignore315 this.store0 = {316 StoreID: null,317 nom: ''318 }319 this.store0.StoreID = resp3[i]["id"];320 this.store0.nom = resp3[i]["nom"];321 this.store0.Commercant = resp3[i]["Commercant"];322 this.listeStore0.push(this.store0);323 }324 this.revenuCeJour = 0325 for (var i = 0; i < Number(resp2['length']); i++) {326 // @ts-ignore327 this.historique3 = {328 enfant: null,329 store: null,330 prixcommande: 0,331 dateachat: null332 }333 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);334 this.historique3.prixcommande = (resp2[i]["prixTotal"]);335 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;336 for (var j = 0; j < this.listeStore0.length; j++) {337 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {338 this.historique3.store = this.listeStore0[j]339 }340 }341 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {342 this.listhist3.push(this.historique3);343 }344 }345 console.log(this.listhist3, "thiiiiiiiisss");346 this.nbrClientParJour5 = 0;347 this.nbrClientParJour5 = this.listhist3.length;348 this.listeNbrTransaction.push(this.nbrClientParJour5)349 this.listeSommeParJour.push(this.revenuCeJour)350 //////////////////////////////////////////////////////////////////////////////////////////////351 this.http.get(this.rootURL + 'commandes6/').subscribe(resp2 => {352 this.http.get(this.rootURL + 'stores/').subscribe(resp3 => {353 this.listhist3 = [];354 this.listeStore0 = [];355 for (var i = 0; i < Number(resp3['length']); i++) {356 // @ts-ignore357 this.store0 = {358 StoreID: null,359 nom: ''360 }361 this.store0.StoreID = resp3[i]["id"];362 this.store0.nom = resp3[i]["nom"];363 this.store0.Commercant = resp3[i]["Commercant"];364 this.listeStore0.push(this.store0);365 }366 this.revenuCeJour = 0367 for (var i = 0; i < Number(resp2['length']); i++) {368 // @ts-ignore369 this.historique3 = {370 enfant: null,371 store: null,372 prixcommande: 0,373 dateachat: null374 }375 this.historique3.dateachat = (resp2[i]["dateCommande"]).substring(0, 10);376 this.historique3.prixcommande = (resp2[i]["prixTotal"]);377 this.revenuCeJour = this.revenuCeJour + this.historique3.prixcommande;378 for (var j = 0; j < this.listeStore0.length; j++) {379 if (resp2[i]["Store"] == this.listeStore0[j].StoreID) {380 this.historique3.store = this.listeStore0[j]381 }382 }383 if (this.historique3.store != null && this.historique3.store.Commercant == this.commercantnumber) {384 this.listhist3.push(this.historique3);385 }386 }387 console.log(this.listhist3, "thiiiiiiiisss");388 this.nbrClientParJour6 = 0;389 this.nbrClientParJour6 = this.listhist3.length;390 this.listeNbrTransaction.push(this.nbrClientParJour6)391 this.listeSommeParJour.push(this.revenuCeJour)392 this.max = this.listeNbrTransaction[0]393 this.min = this.listeNbrTransaction[0]394 for (var k = 0; k < this.listeNbrTransaction.length; k++) {395 if (this.listeNbrTransaction[k] > this.max) {396 this.max = this.listeNbrTransaction[k]397 }398 if (this.listeNbrTransaction[k] < this.min) {399 this.min = this.listeNbrTransaction[k]400 }401 }402 this.maxS = this.listeSommeParJour[0]403 this.minS = this.listeSommeParJour[0]404 for (var k = 0; k < this.listeSommeParJour.length; k++) {405 if (this.listeSommeParJour[k] > this.maxS) {406 this.maxS = this.listeSommeParJour[k]407 }408 if (this.listeSommeParJour[k] < this.minS) {409 this.minS = this.listeSommeParJour[k]410 }411 }412 console.log(this.maxS, "listeSommeParJour")413 console.log(this.listeSommeParJour, "listeSommeParJour")414 /* ----------========== Daily Sales Chart initialization For Documentation ==========---------- */415 const dataDailySalesChart: any = {416 labels: ['', '', '', '', '', "aujourd'hui", ''],417 series: [418 [this.nbrClientParJour6, this.nbrClientParJour5, this.nbrClientParJour4, this.nbrClientParJour3, this.nbrClientParJour2, this.nbrClientParJour1, this.nbrClientParJour0]419 ]420 };421 const optionsDailySalesChart: any = {422 lineSmooth: Chartist.Interpolation.cardinal({423 tension: 0.5424 }),425 low: 0,426 high: this.max + 1, // creative tim: we recommend you to set the high sa the biggest value + something for a better look427 chartPadding: { top: 0, right: 0, bottom: 0, left: 0 },428 }429 var dailySalesChart = new Chartist.Line('#dailySalesChart', dataDailySalesChart, optionsDailySalesChart);430 this.startAnimationForLineChart(dailySalesChart);431 /* ----------========== Completed Tasks Chart initialization ==========---------- */432 const dataCompletedTasksChart: any = {433 labels: ['12p', '3p', '6p', '9p', '12p', '3a', '6a', '9a'],434 series: [435 [230, 750, 450, 300, 280, 240, 200, 190]436 ]437 };438 const optionsCompletedTasksChart: any = {439 lineSmooth: Chartist.Interpolation.cardinal({440 tension: 0441 }),442 low: 0,443 high: 1000, // creative tim: we recommend you to set the high sa the biggest value + something for a better look444 chartPadding: { top: 0, right: 0, bottom: 0, left: 0 }445 }446 var completedTasksChart = new Chartist.Line('#completedTasksChart', dataCompletedTasksChart, optionsCompletedTasksChart);447 // start animation for the Completed Tasks Chart - Line Chart448 this.startAnimationForLineChart(completedTasksChart);449 /* ----------========== Emails Subscription Chart initialization ==========---------- */450 var datawebsiteViewsChart = {451 labels: ['', '', '', '', '', "aujourd'hui", ''],452 series: [453 [this.listeSommeParJour[6], this.listeSommeParJour[5], this.listeSommeParJour[4], this.listeSommeParJour[3], this.listeSommeParJour[2], this.listeSommeParJour[1], this.listeSommeParJour[0]]454 ]455 };456 var optionswebsiteViewsChart = {457 axisX: {458 showGrid: false459 },460 low: 0,461 high: this.maxS,462 chartPadding: { top: 0, right: 5, bottom: 0, left: 0 }463 };464 var responsiveOptions: any[] = [465 ['screen and (max-width: 640px)', {466 seriesBarDistance: 5,467 axisX: {468 labelInterpolationFnc: function (value) {469 return value[0];470 }471 }472 }]473 ];474 var websiteViewsChart = new Chartist.Bar('#websiteViewsChart', datawebsiteViewsChart, optionswebsiteViewsChart, responsiveOptions);475 //start animation for the Emails Subscription Chart476 this.startAnimationForBarChart(websiteViewsChart);477 })478 });479 });480 });481 });482 });483 });484 });485 });486 });487 });488 });489 });490 });491 }492 histo(id: number) {493 this.router.navigate(['KidsPay/Aceuilcommercant/Historique/dashboard'], { queryParams: { idm: id } });494 }...

Full Screen

Full Screen

ActivationTask.test.js

Source:ActivationTask.test.js Github

copy

Full Screen

1import ActivationTask from "./ActivationTask.js";2import AgentQueryType from "./AgentQueryType.js";3import TestData from "./TestData.js";4const { Maneuver, Phase, ShipAction } = XMA;5const { ActionCreator, Reducer } = XMS;6QUnit.module("ActivationTask");7const addPilotToManeuver = store => {8 const maneuver1 = Maneuver.BANK_LEFT_1_STANDARD_1BW;9 const maneuver2 = Maneuver.STRAIGHT_1_STANDARD_1FW;10 const maneuver3 = Maneuver.TURN_RIGHT_1_STANDARD_1YW;11 store.dispatch(12 ActionCreator.setPilotToManeuver({13 1: maneuver1,14 2: maneuver2,15 3: maneuver316 })17 );18};19const initializeStore = () => Redux.createStore(Reducer.root, TestData.createGameState());20const setPhase = (store, phaseKey) => store.dispatch(ActionCreator.setPhase(phaseKey));21const verifyActivationQueue = (assert, store, expected, messagePrefix = "callback ") => {22 const { activationQueue } = store.getState();23 assert.ok(activationQueue, `${messagePrefix}activationQueue`);24 assert.equal(activationQueue.length, expected.length, `${messagePrefix}activationQueue.length`);25 for (let i = 0; i < expected.length; i += 1) {26 assert.equal(activationQueue[i], expected[i], `${messagePrefix}activationQueue[${i}]`);27 }28};29const verifyActivePilotId = (assert, store, expected, messagePrefix = "callback ") =>30 assert.equal(store.getState().activePilotId, expected, `${messagePrefix}activePilotId`);31const verifyAgentQuery = (assert, store, expected, messagePrefix = "callback ") => {32 if (expected === undefined) {33 assert.equal(store.getState().agentQuery, expected, `${messagePrefix}agentQuery`);34 } else {35 const { agentQuery } = store.getState();36 assert.ok(agentQuery, `${messagePrefix}agentQuery`);37 assert.equal(agentQuery.queryKey, expected, `${messagePrefix}agentQuery.queryKey`);38 }39};40const verifyAgentResponse = (assert, store, expected, messagePrefix = "callback ") =>41 assert.equal(store.getState().agentResponse, expected, `${messagePrefix}agentResponse`);42const verifyPhaseKey = (assert, store, expected, messagePrefix = "callback ") =>43 assert.equal(store.getState().phaseKey, expected, `${messagePrefix}phaseKey`);44// /////////////////////////////////////////////////////////////////////////////////////////////////45QUnit.test("doIt() Start", assert => {46 // Setup.47 const store0 = initializeStore();48 setPhase(store0, Phase.ACTIVATION_START);49 // Run.50 const done = assert.async();51 const callback = store => {52 // Verify.53 assert.ok(true, "test resumed from async operation");54 verifyPhaseKey(assert, store, Phase.ACTIVATION_REVEAL_DIAL);55 verifyActivationQueue(assert, store, [2, 1, 3]);56 verifyActivePilotId(assert, store, undefined);57 verifyAgentQuery(assert, store, undefined);58 verifyAgentResponse(assert, store, undefined);59 done();60 };61 ActivationTask.doIt(store0).then(callback);62});63QUnit.test("doIt() Reveal Dial", assert => {64 // Setup.65 const store0 = initializeStore();66 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));67 addPilotToManeuver(store0);68 setPhase(store0, Phase.ACTIVATION_REVEAL_DIAL);69 assert.equal(store0.getState().activePilotId, undefined);70 // Run.71 const done = assert.async();72 const callback = store => {73 // Verify.74 assert.ok(true, "test resumed from async operation");75 verifyPhaseKey(assert, store, Phase.ACTIVATION_SET_TEMPLATE);76 verifyActivationQueue(assert, store, [1, 3]);77 verifyActivePilotId(assert, store, 2);78 verifyAgentQuery(assert, store, undefined);79 verifyAgentResponse(assert, store, undefined);80 done();81 };82 ActivationTask.doIt(store0).then(callback);83});84QUnit.test("doIt() Set Template", assert => {85 // Setup.86 const store0 = initializeStore();87 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));88 store0.dispatch(ActionCreator.dequeueActivation());89 addPilotToManeuver(store0);90 setPhase(store0, Phase.ACTIVATION_SET_TEMPLATE);91 verifyActivePilotId(assert, store0, 2, "");92 // Run.93 const done = assert.async();94 const callback = store => {95 // Verify.96 assert.ok(true, "test resumed from async operation");97 verifyPhaseKey(assert, store, Phase.ACTIVATION_EXECUTE_MANEUVER);98 verifyActivationQueue(assert, store, [1, 3]);99 verifyActivePilotId(assert, store, 2);100 verifyAgentQuery(assert, store, undefined);101 verifyAgentResponse(assert, store, undefined);102 done();103 };104 ActivationTask.doIt(store0).then(callback);105});106QUnit.test("doIt() Execute Maneuver", assert => {107 // Setup.108 const store0 = initializeStore();109 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));110 store0.dispatch(ActionCreator.dequeueActivation());111 addPilotToManeuver(store0);112 setPhase(store0, Phase.ACTIVATION_EXECUTE_MANEUVER);113 verifyActivePilotId(assert, store0, 2, "");114 // Run.115 const done = assert.async();116 const callback = store => {117 // Verify.118 assert.ok(true, "test resumed from async operation");119 verifyPhaseKey(assert, store, Phase.ACTIVATION_CHECK_PILOT_STRESS);120 verifyActivationQueue(assert, store, [1, 3]);121 verifyActivePilotId(assert, store, 2);122 verifyAgentQuery(assert, store, undefined);123 verifyAgentResponse(assert, store, undefined);124 done();125 };126 ActivationTask.doIt(store0).then(callback);127});128QUnit.test("doIt() Check Pilot Stress", assert => {129 // Setup.130 const store0 = initializeStore();131 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));132 store0.dispatch(ActionCreator.dequeueActivation());133 addPilotToManeuver(store0);134 setPhase(store0, Phase.ACTIVATION_CHECK_PILOT_STRESS);135 verifyActivePilotId(assert, store0, 2, "");136 // Run.137 const done = assert.async();138 const callback = store => {139 // Verify.140 assert.ok(true, "test resumed from async operation");141 verifyPhaseKey(assert, store, Phase.ACTIVATION_CLEAN_UP);142 verifyActivationQueue(assert, store, [1, 3]);143 verifyActivePilotId(assert, store, 2);144 verifyAgentQuery(assert, store, undefined);145 verifyAgentResponse(assert, store, undefined);146 done();147 };148 ActivationTask.doIt(store0).then(callback);149});150QUnit.test("doIt() Perform Action query", assert => {151 // Setup.152 const store0 = initializeStore();153 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));154 store0.dispatch(ActionCreator.dequeueActivation());155 addPilotToManeuver(store0);156 setPhase(store0, Phase.ACTIVATION_PERFORM_ACTION);157 verifyActivePilotId(assert, store0, 2, "");158 // Run.159 const done = assert.async();160 const callback = store => {161 // Verify.162 assert.ok(true, "test resumed from async operation");163 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION);164 verifyActivationQueue(assert, store, [1, 3]);165 verifyActivePilotId(assert, store, 2);166 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_SHIP_ACTION);167 verifyAgentResponse(assert, store, undefined);168 done();169 };170 ActivationTask.doIt(store0).then(callback);171});172QUnit.test("doIt() Perform Action response", assert => {173 // Setup.174 const store0 = initializeStore();175 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));176 store0.dispatch(ActionCreator.dequeueActivation());177 addPilotToManeuver(store0);178 const agentResponse = XMS.AgentResponseState.create({179 agentId: 1,180 responseKey: AgentQueryType.CHOOSE_SHIP_ACTION,181 payload: {182 pilotId: 2,183 shipActionKey: ShipAction.FOCUS184 }185 });186 store0.dispatch(ActionCreator.setAgentResponse(agentResponse));187 setPhase(store0, Phase.ACTIVATION_PERFORM_ACTION);188 verifyActivePilotId(assert, store0, 2, "");189 // Run.190 const done = assert.async();191 const callback = store => {192 // Verify.193 assert.ok(true, "test resumed from async operation");194 verifyPhaseKey(assert, store, Phase.ACTIVATION_REVEAL_DIAL);195 verifyActivationQueue(assert, store, [1, 3]);196 verifyActivePilotId(assert, store, 2);197 verifyAgentQuery(assert, store, undefined);198 verifyAgentResponse(assert, store, undefined);199 done();200 };201 ActivationTask.doIt(store0).then(callback);202});203QUnit.test("doIt() End", assert => {204 // Setup.205 const store0 = initializeStore();206 store0.dispatch(ActionCreator.setPhase(Phase.ACTIVATION_END));207 // Run.208 const done = assert.async();209 const callback = store => {210 // Verify.211 assert.ok(true, "test resumed from async operation");212 verifyPhaseKey(assert, store, Phase.COMBAT_START);213 verifyActivationQueue(assert, store, []);214 verifyActivePilotId(assert, store, undefined);215 verifyAgentQuery(assert, store, undefined);216 verifyAgentResponse(assert, store, undefined);217 done();218 };219 ActivationTask.doIt(store0).then(callback);220});221QUnit.test("doIt() Full Cycle", assert => {222 // Setup.223 const store0 = initializeStore();224 store0.dispatch(ActionCreator.setActivationQueue([2, 1, 3]));225 addPilotToManeuver(store0);226 setPhase(store0, Phase.ACTIVATION_START);227 assert.equal(store0.getState().activePilotId, undefined);228 // Run.229 const done = assert.async();230 const callback23 = store => {231 // Verify.232 verifyPhaseKey(assert, store, Phase.ACTIVATION_END, "callback23 ");233 verifyActivationQueue(assert, store, [], "callback23 ");234 verifyAgentQuery(assert, store, undefined, "callback23 ");235 verifyAgentResponse(assert, store, undefined, "callback23 ");236 done();237 };238 const callback22 = store => {239 // Verify.240 verifyPhaseKey(assert, store, Phase.ACTIVATION_REVEAL_DIAL, "callback22 ");241 verifyActivationQueue(assert, store, [], "callback22 ");242 verifyAgentQuery(assert, store, undefined, "callback22 ");243 verifyAgentResponse(assert, store, undefined, "callback22 ");244 ActivationTask.doIt(store).then(callback23);245 };246 const callback21 = store => {247 // Verify.248 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION, "callback21");249 verifyActivationQueue(assert, store, [], "callback21");250 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_SHIP_ACTION, "callback21");251 const { agentQuery } = store.getState();252 const agentResponse = XMS.AgentResponseState.create({253 agentId: agentQuery.agentId,254 responseKey: AgentQueryType.CHOOSE_SHIP_ACTION,255 payload: {256 pilotId: agentQuery.payload.pilotId,257 shipActionKey: ShipAction.FOCUS258 }259 });260 store.dispatch(ActionCreator.clearAgentQuery());261 store.dispatch(ActionCreator.setAgentResponse(agentResponse));262 ActivationTask.doIt(store).then(callback22);263 };264 const callback20 = store => {265 // Verify.266 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION, "callback20");267 verifyActivationQueue(assert, store, [], "callback20");268 verifyAgentQuery(assert, store, undefined, "callback20");269 verifyAgentResponse(assert, store, undefined, "callback20");270 ActivationTask.doIt(store).then(callback21);271 };272 const callback19 = store => {273 // Verify.274 verifyPhaseKey(assert, store, Phase.ACTIVATION_CLEAN_UP, "callback19");275 verifyActivationQueue(assert, store, [], "callback19");276 verifyAgentQuery(assert, store, undefined, "callback19");277 verifyAgentResponse(assert, store, undefined, "callback19");278 ActivationTask.doIt(store).then(callback20);279 };280 const callback18 = store => {281 // Verify.282 verifyPhaseKey(assert, store, Phase.ACTIVATION_CHECK_PILOT_STRESS, "callback18");283 verifyActivationQueue(assert, store, [], "callback18");284 verifyAgentQuery(assert, store, undefined, "callback18");285 verifyAgentResponse(assert, store, undefined, "callback18");286 ActivationTask.doIt(store).then(callback19);287 };288 const callback17 = store => {289 // Verify.290 verifyPhaseKey(assert, store, Phase.ACTIVATION_EXECUTE_MANEUVER, "callback17");291 verifyActivationQueue(assert, store, [], "callback17");292 verifyAgentQuery(assert, store, undefined, "callback17");293 verifyAgentResponse(assert, store, undefined, "callback17");294 ActivationTask.doIt(store).then(callback18);295 };296 const callback16 = store => {297 // Verify.298 verifyPhaseKey(assert, store, Phase.ACTIVATION_SET_TEMPLATE, "callback09");299 verifyActivationQueue(assert, store, [], "callback09");300 verifyAgentQuery(assert, store, undefined, "callback09");301 verifyAgentResponse(assert, store, undefined, "callback09");302 ActivationTask.doIt(store).then(callback17);303 };304 const callback15 = store => {305 // Verify.306 verifyPhaseKey(assert, store, Phase.ACTIVATION_REVEAL_DIAL, "callback15 ");307 verifyActivationQueue(assert, store, [3], "callback15 ");308 verifyAgentQuery(assert, store, undefined, "callback15 ");309 verifyAgentResponse(assert, store, undefined, "callback15 ");310 ActivationTask.doIt(store).then(callback16);311 };312 const callback14 = store => {313 // Verify.314 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION, "callback14");315 verifyActivationQueue(assert, store, [3], "callback14");316 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_SHIP_ACTION, "callback14");317 const { agentQuery } = store.getState();318 const agentResponse = XMS.AgentResponseState.create({319 agentId: agentQuery.agentId,320 responseKey: AgentQueryType.CHOOSE_SHIP_ACTION,321 payload: {322 pilotId: agentQuery.payload.pilotId,323 shipActionKey: ShipAction.FOCUS324 }325 });326 store.dispatch(ActionCreator.clearAgentQuery());327 store.dispatch(ActionCreator.setAgentResponse(agentResponse));328 ActivationTask.doIt(store).then(callback15);329 };330 const callback13 = store => {331 // Verify.332 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION, "callback13");333 verifyActivationQueue(assert, store, [3], "callback13");334 verifyAgentQuery(assert, store, undefined, "callback13");335 verifyAgentResponse(assert, store, undefined, "callback13");336 ActivationTask.doIt(store).then(callback14);337 };338 const callback12 = store => {339 // Verify.340 verifyPhaseKey(assert, store, Phase.ACTIVATION_CLEAN_UP, "callback12");341 verifyActivationQueue(assert, store, [3], "callback12");342 verifyAgentQuery(assert, store, undefined, "callback12");343 verifyAgentResponse(assert, store, undefined, "callback12");344 ActivationTask.doIt(store).then(callback13);345 };346 const callback11 = store => {347 // Verify.348 verifyPhaseKey(assert, store, Phase.ACTIVATION_CHECK_PILOT_STRESS, "callback11");349 verifyActivationQueue(assert, store, [3], "callback11");350 verifyAgentQuery(assert, store, undefined, "callback11");351 verifyAgentResponse(assert, store, undefined, "callback11");352 ActivationTask.doIt(store).then(callback12);353 };354 const callback10 = store => {355 // Verify.356 verifyPhaseKey(assert, store, Phase.ACTIVATION_EXECUTE_MANEUVER, "callback10");357 verifyActivationQueue(assert, store, [3], "callback10");358 verifyAgentQuery(assert, store, undefined, "callback10");359 verifyAgentResponse(assert, store, undefined, "callback10");360 ActivationTask.doIt(store).then(callback11);361 };362 const callback09 = store => {363 // Verify.364 verifyPhaseKey(assert, store, Phase.ACTIVATION_SET_TEMPLATE, "callback09");365 verifyActivationQueue(assert, store, [3], "callback09");366 verifyAgentQuery(assert, store, undefined, "callback09");367 verifyAgentResponse(assert, store, undefined, "callback09");368 ActivationTask.doIt(store).then(callback10);369 };370 const callback8 = store => {371 // Verify.372 verifyPhaseKey(assert, store, Phase.ACTIVATION_REVEAL_DIAL, "callback8 ");373 verifyActivationQueue(assert, store, [1, 3], "callback8 ");374 verifyAgentQuery(assert, store, undefined, "callback8 ");375 verifyAgentResponse(assert, store, undefined, "callback8 ");376 ActivationTask.doIt(store).then(callback09);377 };378 const callback7 = store => {379 // Verify.380 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION, "callback7");381 verifyActivationQueue(assert, store, [1, 3], "callback7");382 verifyAgentQuery(assert, store, AgentQueryType.CHOOSE_SHIP_ACTION, "callback7");383 const { agentQuery } = store.getState();384 const agentResponse = XMS.AgentResponseState.create({385 agentId: agentQuery.agentId,386 responseKey: AgentQueryType.CHOOSE_SHIP_ACTION,387 payload: {388 pilotId: agentQuery.payload.pilotId,389 shipActionKey: ShipAction.FOCUS390 }391 });392 store.dispatch(ActionCreator.clearAgentQuery());393 store.dispatch(ActionCreator.setAgentResponse(agentResponse));394 ActivationTask.doIt(store).then(callback8);395 };396 const callback6 = store => {397 // Verify.398 verifyPhaseKey(assert, store, Phase.ACTIVATION_PERFORM_ACTION, "callback6");399 verifyActivationQueue(assert, store, [1, 3], "callback6");400 verifyAgentQuery(assert, store, undefined, "callback6");401 verifyAgentResponse(assert, store, undefined, "callback6");402 ActivationTask.doIt(store).then(callback7);403 };404 const callback5 = store => {405 // Verify.406 verifyPhaseKey(assert, store, Phase.ACTIVATION_CLEAN_UP, "callback5");407 verifyActivationQueue(assert, store, [1, 3], "callback5");408 verifyAgentQuery(assert, store, undefined, "callback5");409 verifyAgentResponse(assert, store, undefined, "callback5");410 ActivationTask.doIt(store).then(callback6);411 };412 const callback4 = store => {413 // Verify.414 verifyPhaseKey(assert, store, Phase.ACTIVATION_CHECK_PILOT_STRESS, "callback4");415 verifyActivationQueue(assert, store, [1, 3], "callback4");416 verifyAgentQuery(assert, store, undefined, "callback4");417 verifyAgentResponse(assert, store, undefined, "callback4");418 ActivationTask.doIt(store).then(callback5);419 };420 const callback3 = store => {421 // Verify.422 verifyPhaseKey(assert, store, Phase.ACTIVATION_EXECUTE_MANEUVER, "callback3");423 verifyActivationQueue(assert, store, [1, 3], "callback3");424 verifyAgentQuery(assert, store, undefined, "callback3");425 verifyAgentResponse(assert, store, undefined, "callback3");426 ActivationTask.doIt(store).then(callback4);427 };428 const callback2 = store => {429 // Verify.430 verifyPhaseKey(assert, store, Phase.ACTIVATION_SET_TEMPLATE, "callback2");431 verifyActivationQueue(assert, store, [1, 3], "callback2");432 verifyAgentQuery(assert, store, undefined, "callback2");433 verifyAgentResponse(assert, store, undefined, "callback2");434 ActivationTask.doIt(store).then(callback3);435 };436 const callback1 = store => {437 // Verify.438 verifyPhaseKey(assert, store, Phase.ACTIVATION_REVEAL_DIAL, "callback1 ");439 verifyActivationQueue(assert, store, [2, 1, 3], "callback1 ");440 verifyAgentQuery(assert, store, undefined, "callback1 ");441 verifyAgentResponse(assert, store, undefined, "callback1 ");442 ActivationTask.doIt(store).then(callback2);443 };444 ActivationTask.doIt(store0).then(callback1);445});446const ActivationTaskTest = {};...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2 if (err) {3 console.log(err);4 } else {5 console.log(data);6 }7});8var wpt = require('wpt');9 if (err) {10 console.log(err);11 } else {12 console.log(data);13 }14});

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('wpt');2 if (err) {3 console.log(err);4 } else {5 console.log(data);6 }7});8### wpt.store0(url, callback)

Full Screen

Using AI Code Generation

copy

Full Screen

1const wpt = require('wpt');2 if (err) {3 console.log(err);4 } else {5 console.log(data);6 }7});8const wpt = require('wpt');9 if (err) {10 console.log(err);11 } else {12 console.log(data);13 }14});15const wpt = require('wpt');16 if (err) {17 console.log(err);18 } else {19 console.log(data);20 }21});22const wpt = require('wpt');23 if (err) {24 console.log(err);25 } else {26 console.log(data);27 }28});29const wpt = require('wpt');30 if (err) {31 console.log(err);32 } else {33 console.log(data);34 }35});36const wpt = require('wpt');37 if (err) {38 console.log(err);39 } else {40 console.log(data);41 }42});43const wpt = require('wpt');44 if (err) {45 console.log(err);46 } else {47 console.log(data);48 }49});50const wpt = require('wpt');

Full Screen

Using AI Code Generation

copy

Full Screen

1var wptools = require('wptools');2var store0 = wptools.store0;3var store1 = wptools.store1;4var store2 = wptools.store2;5var wptools = require('wptools');6var store0 = wptools.store0;7var store1 = wptools.store1;8var store2 = wptools.store2;9var wptools = require('wptools');10var store0 = wptools.store0;11var store1 = wptools.store1;12var store2 = wptools.store2;13var wptools = require('wptools');14var store0 = wptools.store0;15var store1 = wptools.store1;16var store2 = wptools.store2;17var wptools = require('wptools');18var store0 = wptools.store0;19var store1 = wptools.store1;20var store2 = wptools.store2;21var wptools = require('wptools');22var store0 = wptools.store0;23var store1 = wptools.store1;24var store2 = wptools.store2;25var wptools = require('wptools');26var store0 = wptools.store0;27var store1 = wptools.store1;28var store2 = wptools.store2;29var wptools = require('wptools');30var store0 = wptools.store0;

Full Screen

Using AI Code Generation

copy

Full Screen

1var wpt = require('./wpt.js');2wpt.store0('test', 1, function(err, data) {3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});9module.exports = {10 store0: function(key, value, callback) {11 var data = {};12 data[key] = value;13 callback(null, data);14 }15};

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run wpt automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful