Skip to content

Commit a3f100b

Browse files
author
Michael Hahn
authored
Merge pull request #31 from slackhq/strictify-all-files
Mark all test files as `// strict`
2 parents ff6d9ea + 4a94acd commit a3f100b

18 files changed

+75
-179
lines changed

tests/AddressSchemaValidatorTest.php

Lines changed: 14 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

55
use namespace HH\Lib\C;
66
use function Facebook\FBExpect\expect;
77

8-
use type Slack\Hack\JsonSchema\Tests\Generated\{
9-
AddressSchemaFileValidator,
10-
AddressSchemaValidator,
11-
};
8+
use type Slack\Hack\JsonSchema\Tests\Generated\{AddressSchemaFileValidator, AddressSchemaValidator};
129

1310
final class AddressSchemaValidatorTest extends BaseCodegenTestCase {
1411

1512
<<__Override>>
1613
public static async function beforeFirstTestAsync(): Awaitable<void> {
1714
$ret = self::getBuilder('address-schema.json', 'AddressSchemaValidator');
1815
$ret['codegen']->build();
19-
$ret_remote = self::getBuilder(
20-
'address-schema-remote.json',
21-
'AddressSchemaFileValidator',
22-
);
16+
$ret_remote = self::getBuilder('address-schema-remote.json', 'AddressSchemaFileValidator');
2317
$ret_remote['codegen']->build();
2418
require_once($ret['path']);
2519
require_once($ret_remote['path']);
@@ -63,9 +57,7 @@ public function testAddressWithNumericPostalCode(): void {
6357
]);
6458
$validator->validate();
6559

66-
expect($validator->isValid())->toBeTrue(
67-
'numeric postal codes should be valid',
68-
);
60+
expect($validator->isValid())->toBeTrue('numeric postal codes should be valid');
6961
}
7062

7163
public function testAddressWithInvalidPostalCode(): void {
@@ -93,9 +85,7 @@ public function testAddressWithFileRef(): void {
9385
]);
9486
$validator->validate();
9587

96-
expect($validator->isValid())->toBeTrue(
97-
'file reference to phone type should be valid',
98-
);
88+
expect($validator->isValid())->toBeTrue('file reference to phone type should be valid');
9989
}
10090

10191
public function testAddressWithSizeAllOf(): void {
@@ -106,9 +96,7 @@ public function testAddressWithSizeAllOf(): void {
10696
'size' => 200,
10797
]);
10898
$validator->validate();
109-
expect($validator->isValid())->toBeTrue(
110-
'should be valid as 200 is both an integer and a number',
111-
);
99+
expect($validator->isValid())->toBeTrue('should be valid as 200 is both an integer and a number');
112100
}
113101

114102
public function testAddressWithSizeAllOfFailure(): void {
@@ -119,9 +107,7 @@ public function testAddressWithSizeAllOfFailure(): void {
119107
'size' => 200.5,
120108
]);
121109
$validator->validate();
122-
expect($validator->isValid())->toBeFalse(
123-
'should not be valid as 200.5 is not an integer',
124-
);
110+
expect($validator->isValid())->toBeFalse('should not be valid as 200.5 is not an integer');
125111
}
126112

127113
public function testAddressWithLongitudeNot(): void {
@@ -132,9 +118,7 @@ public function testAddressWithLongitudeNot(): void {
132118
'longitude' => 200.5,
133119
]);
134120
$validator->validate();
135-
expect($validator->isValid())->toBeTrue(
136-
'should be valid as 200.5 is not an integer nor a string',
137-
);
121+
expect($validator->isValid())->toBeTrue('should be valid as 200.5 is not an integer nor a string');
138122
}
139123

140124
public function testAddressWithLongitudeNotFailure(): void {
@@ -145,9 +129,7 @@ public function testAddressWithLongitudeNotFailure(): void {
145129
'longitude' => 200,
146130
]);
147131
$validator->validate();
148-
expect($validator->isValid())->toBeFalse(
149-
'should not be valid as 200 is an integer',
150-
);
132+
expect($validator->isValid())->toBeFalse('should not be valid as 200 is an integer');
151133
}
152134

153135
public function testAddressWithLatitudeOneOf(): void {
@@ -158,9 +140,7 @@ public function testAddressWithLatitudeOneOf(): void {
158140
'latitude' => 200.5,
159141
]);
160142
$validator->validate();
161-
expect($validator->isValid())->toBeTrue(
162-
'should be valid as 200.5 is not an integer but is a number',
163-
);
143+
expect($validator->isValid())->toBeTrue('should be valid as 200.5 is not an integer but is a number');
164144
}
165145

166146
public function testAddressWithLatitudeOneOfFailure(): void {
@@ -171,9 +151,7 @@ public function testAddressWithLatitudeOneOfFailure(): void {
171151
'latitude' => 200,
172152
]);
173153
$validator->validate();
174-
expect($validator->isValid())->toBeFalse(
175-
'should not be valid as 200 is an integer and number',
176-
);
154+
expect($validator->isValid())->toBeFalse('should not be valid as 200 is an integer and number');
177155
}
178156

179157
public function testAddressWithFailedFileRef(): void {
@@ -188,9 +166,7 @@ public function testAddressWithFailedFileRef(): void {
188166
],
189167
]);
190168
$validator->validate();
191-
expect($validator->isValid())->toBeFalse(
192-
'file reference to phone type should be invalid',
193-
);
169+
expect($validator->isValid())->toBeFalse('file reference to phone type should be invalid');
194170
expect(C\count($validator->getErrors()))->toBeSame(3);
195171
}
196172

@@ -209,9 +185,7 @@ public function testAddressWithDifferentFileRef(): void {
209185
]);
210186
$validator->validate();
211187

212-
expect($validator->isValid())->toBeTrue(
213-
'file reference to phone type should be valid',
214-
);
188+
expect($validator->isValid())->toBeTrue('file reference to phone type should be valid');
215189
}
216190

217191
public function testAddressWithFalseDepthRefs(): void {
@@ -229,9 +203,7 @@ public function testAddressWithFalseDepthRefs(): void {
229203
]);
230204
$validator->validate();
231205

232-
expect($validator->isValid())->toBeFalse(
233-
'file reference to phone type should be valid',
234-
);
206+
expect($validator->isValid())->toBeFalse('file reference to phone type should be valid');
235207
expect(C\count($validator->getErrors()))->toBeSame(2);
236208
}
237209

tests/AnyOfRefiningTest.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

55
use function Facebook\FBExpect\expect;
66

7-
use type Slack\Hack\JsonSchema\Tests\Generated\{
8-
AnyOfValidator1,
9-
AnyOfValidator2,
10-
AnyOfValidator3,
11-
AnyOfValidator4,
12-
};
7+
use type Slack\Hack\JsonSchema\Tests\Generated\{AnyOfValidator1, AnyOfValidator2, AnyOfValidator3, AnyOfValidator4};
138

149
final class AnyOfRefiningTest extends BaseCodegenTestCase {
1510

tests/ArraySchemaValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

tests/BaseCodegenTestCase.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

tests/BooleanSchemaValidatorTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

@@ -65,9 +65,7 @@ public function testCoerceValid(): void {
6565
]);
6666
$validator->validate();
6767

68-
expect($validator->isValid())->toBeTrue(
69-
"should be valid for input: '{$case['input']}'",
70-
);
68+
expect($validator->isValid())->toBeTrue("should be valid for input: '{$case['input']}'");
7169

7270
$validated = $validator->getValidatedInput();
7371
expect($validated)->toNotBeNull('should be valid');

tests/CodegenForPathsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

tests/CustomCodegenConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

tests/DefaultsSchemaValidatorTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

@@ -74,19 +74,16 @@ public function testNestedCoerceFalse(): void {
7474
$_cases = vec[
7575
shape(
7676
'input' => darray[
77-
'nested_coerce_false' =>
78-
darray['boolean_prop' => 'false', 'number_prop' => 3],
77+
'nested_coerce_false' => darray['boolean_prop' => 'false', 'number_prop' => 3],
7978
],
8079
'output' => darray[
81-
'nested_coerce_false' =>
82-
darray['boolean_prop' => false, 'number_prop' => 3],
80+
'nested_coerce_false' => darray['boolean_prop' => false, 'number_prop' => 3],
8381
],
8482
'valid' => true,
8583
),
8684
shape(
8785
'input' => darray[
88-
'nested_coerce_false' =>
89-
darray['boolean_prop' => true, 'number_prop' => '3'],
86+
'nested_coerce_false' => darray['boolean_prop' => true, 'number_prop' => '3'],
9087
],
9188
'valid' => false,
9289
),

tests/EmptySchemaValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

tests/EnumSchemaValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?hh // partial
1+
<?hh // strict
22

33
namespace Slack\Hack\JsonSchema\Tests;
44

0 commit comments

Comments
 (0)