Skip to content

Commit 5a358eb

Browse files
authored
test: load and use rubocop-minitest (#1201)
1 parent 2fca867 commit 5a358eb

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

.rubocop.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
require:
2+
- rubocop-minitest
3+
14
AllCops:
25
NewCops: enable
36
Exclude:

test/test_pod_helpers.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def test_fabric_enabled?
1919

2020
# `RCT_NEW_ARCH_ENABLED` enables everything
2121
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
22+
2223
refute(fabric_enabled?({}, 6799))
2324
assert(fabric_enabled?({}, 6800))
2425
end
@@ -38,6 +39,7 @@ def test_new_architecture_enabled?
3839

3940
# `RCT_NEW_ARCH_ENABLED` enables everything
4041
ENV['RCT_NEW_ARCH_ENABLED'] = '1'
42+
4143
refute(new_architecture_enabled?({}, 6799))
4244
assert(new_architecture_enabled?({}, 6800))
4345
end

test/test_test_app.rb

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,19 @@ def fixture_path(*args)
1919
class TestTestApp < Minitest::Test
2020
def test_app_config
2121
name, display_name, single_app = app_config(fixture_path('with_resources'))
22-
assert_equal(name, 'TestFixture')
23-
assert_equal(display_name, 'Test Fixture')
22+
23+
assert_equal('TestFixture', name)
24+
assert_equal('Test Fixture', display_name)
2425
assert_nil(single_app)
2526
end
2627

2728
def test_app_config_single_app
2829
name, display_name, version, single_app = app_config(fixture_path('single_app_mode'))
29-
assert_equal(name, 'TestFixture')
30-
assert_equal(display_name, 'Test Fixture')
31-
assert_equal(version, '1.0.0')
32-
assert_equal(single_app, 'test-fixture')
30+
31+
assert_equal('TestFixture', name)
32+
assert_equal('Test Fixture', display_name)
33+
assert_equal('1.0.0', version)
34+
assert_equal('test-fixture', single_app)
3335
end
3436

3537
def test_autolink_script_path
@@ -40,33 +42,37 @@ def test_autolink_script_path
4042
end
4143

4244
def test_flipper_enabled?
43-
assert(flipper_enabled?)
45+
assert_predicate(self, :flipper_enabled?)
4446

4547
use_flipper!(false)
4648

47-
refute(flipper_enabled?)
49+
refute_predicate(self, :flipper_enabled?)
4850

4951
use_flipper!
5052

51-
assert(flipper_enabled?)
53+
assert_predicate(self, :flipper_enabled?)
5254
ensure
5355
use_flipper!(nil)
5456
end
5557

5658
def test_flipper_versions
57-
assert_equal({}, flipper_versions)
59+
assert_empty(flipper_versions)
5860

5961
use_flipper!(false)
62+
6063
refute(flipper_versions)
6164

6265
versions = { 'Flipper' => '~> 0.41.1' }
6366
use_flipper!(versions)
67+
6468
assert_equal(versions, flipper_versions)
6569

6670
use_flipper!
67-
assert_equal({}, flipper_versions)
71+
72+
assert_empty(flipper_versions)
6873

6974
use_flipper!(false)
75+
7076
refute(flipper_versions)
7177
ensure
7278
use_flipper!(nil)
@@ -78,16 +84,19 @@ def test_nearest_node_modules
7884
assert_equal(expected, nearest_node_modules(fixture_path('test_app')))
7985

8086
react_native = fixture_path('test_app', 'node_modules', 'react-native')
87+
8188
assert_equal(expected, nearest_node_modules(react_native))
8289

8390
assert_equal(expected, nearest_node_modules(fixture_path('test_app', 'src')))
8491
end
8592

8693
def test_package_version
8794
react_native = fixture_path('test_app', 'node_modules', 'react-native')
95+
8896
assert_equal(Gem::Version.new('1000.0.0'), package_version(react_native))
8997

9098
cli = fixture_path('test_app', 'node_modules', '@react-native-community', 'cli-platform-ios')
99+
91100
assert_equal(Gem::Version.new('4.10.1'), package_version(cli))
92101
end
93102

@@ -170,7 +179,7 @@ def test_react_native_pods
170179
manifest = JSON.parse(File.read(manifest_path))
171180

172181
if project_root.to_s.include?('without')
173-
assert_equal([], manifest['resources'])
182+
assert_empty(manifest['resources'])
174183
elsif project_root.to_s.include?('with_platform_resources')
175184
assert_equal(platform_resources, manifest['resources'].sort)
176185
else
@@ -190,6 +199,7 @@ def test_macos_project_cannot_set_development_team
190199

191200
project = Xcodeproj::Project.open('macos/ReactTestApp.xcodeproj')
192201
test_app = project.targets.detect { |target| target.name == 'ReactTestApp' }
202+
193203
assert(test_app)
194204
test_app.build_configurations.each do |config|
195205
assert_equal('-', config.build_settings['CODE_SIGN_IDENTITY'])

0 commit comments

Comments
 (0)