-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest-sandbox.ts
113 lines (96 loc) · 2.38 KB
/
test-sandbox.ts
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
const a = 3;
const testString = `${3} apples`;
const message = 'Hello World!';
console.log('Hello');
console.log(message);
class Test {
@testDecorator()
prop;
}
it('should change appTooltip disabled prop based on dimensions', () => {
expect(isTooltipDisabled(divEl)).toEqual(true);
const BIGGER_VALUE = 2;
const SMALLER_VALUE = 1;
changeDimensions(BIGGER_VALUE, SMALLER_VALUE);
divEl.triggerEventHandler('mouseenter', null);
fixture.detectChanges();
expect(isTooltipDisabled(divEl)).toEqual(false);
expect(isTooltipDisabled(divEl)).toEqual(true);
changeDimensions(SMALLER_VALUE, BIGGER_VALUE);
const a = 2;
divEl.triggerEventHandler('mouseenter', null);
fixture.detectChanges();
expect(isTooltipDisabled(divEl)).toEqual(false);
});
class UserModel {
firstName: string;
lastName: string;
age: number;
increaseAge(years: number): void {
this.age += years;
}
getProfileTitle(): string {
return `User ${this.firstName} ${this.lastName} is ${this.age} years old`;
}
}
function printQuiz(questions) {
questions.forEach(question => {
console.log(question.description);
switch (question.type) {
case 'boolean':
console.log('1. True');
console.log('2. False');
break;
case 'multipleChoice':
question.options.foreach((option, index) => {
console.log(`${index + 1}. ${option}`);
});
break;
case 'text':
console.log(`Answer:__________`);
break;
}
console.log('');
});
}
function drawShape(shape: Shape): void {
if (shape instanceof Square) {
this.drawSquare(shape as Square);
} else {
this.drawCircle(shape as Circle);
}
}
class Turret extends Entity {
constructor(name, attackDamage) {
super(name, attackDamage, -1);
}
move() {
return null;
}
takeDamage() {
return null;
}
}
class Store {
paymentProcessor: PayPalPaymentProcessor;
constructor(paymentProcessor: PayPalPaymentProcessor) {
this.paymentProcessor = paymentProcessor;
}
purchaseBike(quantity) {
this.paymentProcessor.pay(200 * quantity);
}
purchaseHelmet(quantity) {
this.paymentProcessor.pay(15 * quantity);
}
}
class PayPalPaymentProcessor {
payPal;
user;
constructor(user) {
this.user = user;
this.payPal = new PayPal();
}
pay(amountInDollars) {
this.payPal.makePayment(this.user, amountInDollars * 2.54);
}
}