Skip to content

Commit 38a29e0

Browse files
Merge pull request #356 from Workiva/unpin-mockito
FED-1161 Unpin mockito, fix CI
2 parents b18b417 + 8b54ab5 commit 38a29e0

File tree

5 files changed

+39
-45
lines changed

5 files changed

+39
-45
lines changed

.github/workflows/dart_ci.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
strategy:
1616
fail-fast: false
1717
matrix:
18-
sdk: [2.13.4, stable, beta]
18+
# Can't run on `beta` (Dart 3) until we're fully null-safe.
19+
sdk: [2.18.7, stable]
1920
steps:
2021
- uses: actions/checkout@v2
2122
- uses: dart-lang/setup-dart@v1
@@ -35,7 +36,7 @@ jobs:
3536

3637
- name: Verify formatting
3738
run: dart format --output=none --line-length=120 --set-exit-if-changed .
38-
if: ${{ matrix.sdk == '2.13.4' }}
39+
if: ${{ matrix.sdk == '2.18.7' }}
3940

4041
- name: Analyze project source
4142
run: dart analyze

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
FROM google/dart:2.13
1+
FROM drydock-prod.workiva.net/workiva/dart2_base_image:1 as dart2
2+
3+
RUN dart --version
24

35
WORKDIR /build
46
COPY pubspec.yaml .

lib/react_test_utils.dart

+10-30
Original file line numberDiff line numberDiff line change
@@ -120,37 +120,27 @@ class Simulate {
120120
///
121121
/// Included in Dart for completeness
122122
@JS('React.addons.TestUtils.findAllInRenderedTree')
123-
external List<dynamic> findAllInRenderedTree(
124-
/* [1] */ tree,
125-
ComponentTestFunction test);
123+
external List<dynamic> findAllInRenderedTree(/* [1] */ tree, ComponentTestFunction test);
126124

127125
/// Like scryRenderedDOMComponentsWithClass() but expects there to be one
128126
/// result, and returns that one result, or throws exception if there is
129127
/// any other number of matches besides one.
130128
@JS('React.addons.TestUtils.findRenderedDOMComponentWithClass')
131-
external dynamic /* [1] */ findRenderedDOMComponentWithClass(
132-
/* [1] */ tree,
133-
String className);
129+
external dynamic /* [1] */ findRenderedDOMComponentWithClass(/* [1] */ tree, String className);
134130

135131
/// Like scryRenderedDOMComponentsWithTag() but expects there to be one result,
136132
/// and returns that one result, or throws exception if there is any other
137133
/// number of matches besides one.
138134
@JS('React.addons.TestUtils.findRenderedDOMComponentWithTag')
139-
external dynamic /* [1] */ findRenderedDOMComponentWithTag(
140-
/* [1] */ tree,
141-
String tag);
135+
external dynamic /* [1] */ findRenderedDOMComponentWithTag(/* [1] */ tree, String tag);
142136

143137
@JS('React.addons.TestUtils.findRenderedComponentWithType')
144-
external dynamic /* [1] */ _findRenderedComponentWithType(
145-
/* [1] */ tree,
146-
dynamic type);
138+
external dynamic /* [1] */ _findRenderedComponentWithType(/* [1] */ tree, dynamic type);
147139

148140
/// Same as [scryRenderedComponentsWithTypeV2] but expects there to be one result
149141
/// and returns that one result, or throws exception if there is any other
150142
/// number of matches besides one.
151-
/* [1] */ findRenderedComponentWithTypeV2(
152-
/* [1] */ tree,
153-
ReactComponentFactoryProxy componentFactory) {
143+
/* [1] */ findRenderedComponentWithTypeV2(/* [1] */ tree, ReactComponentFactoryProxy componentFactory) {
154144
return _findRenderedComponentWithType(tree, getComponentTypeV2(componentFactory));
155145
}
156146

@@ -171,9 +161,7 @@ external bool _isCompositeComponentWithType(/* [1] */ instance, dynamic type);
171161

172162
/// Returns `true` if instance is a custom composite component created using `React.createClass()`
173163
/// that is of the [ReactComponentFactoryProxy.type] of the provided [componentFactory].
174-
bool isCompositeComponentWithTypeV2(
175-
/* [1] */ instance,
176-
ReactComponentFactoryProxy componentFactory) {
164+
bool isCompositeComponentWithTypeV2(/* [1] */ instance, ReactComponentFactoryProxy componentFactory) {
177165
return _isCompositeComponentWithType(instance, getComponentTypeV2(componentFactory));
178166
}
179167

@@ -195,33 +183,25 @@ bool isElementOfTypeV2(dynamic element, ReactComponentFactoryProxy componentFact
195183
}
196184

197185
@JS('React.addons.TestUtils.scryRenderedComponentsWithType')
198-
external List<dynamic> /* [1] */ _scryRenderedComponentsWithType(
199-
/* [1] */ tree,
200-
dynamic type);
186+
external List<dynamic> /* [1] */ _scryRenderedComponentsWithType(/* [1] */ tree, dynamic type);
201187

202188
/// Finds all instances within the provided [tree]
203189
/// that are of the [ReactComponentFactoryProxy.type] of the provided [componentFactory].
204-
List<dynamic> /* [1] */ scryRenderedComponentsWithTypeV2(
205-
/* [1] */ tree,
206-
ReactComponentFactoryProxy componentFactory) {
190+
List<dynamic> /* [1] */ scryRenderedComponentsWithTypeV2(/* [1] */ tree, ReactComponentFactoryProxy componentFactory) {
207191
return _scryRenderedComponentsWithType(tree, getComponentTypeV2(componentFactory));
208192
}
209193

210194
@JS('React.addons.TestUtils.scryRenderedDOMComponentsWithClass')
211195

212196
/// Finds all instances of components in the rendered tree that are DOM
213197
/// components with the class name matching className.
214-
external List<dynamic> scryRenderedDOMComponentsWithClass(
215-
/* [1] */ tree,
216-
String className);
198+
external List<dynamic> scryRenderedDOMComponentsWithClass(/* [1] */ tree, String className);
217199

218200
@JS('React.addons.TestUtils.scryRenderedDOMComponentsWithTag')
219201

220202
/// Finds all instances of components in the rendered tree that are DOM
221203
/// components with the tag name matching tagName.
222-
external List<dynamic> scryRenderedDOMComponentsWithTag(
223-
/* [1] */ tree,
224-
String tagName);
204+
external List<dynamic> scryRenderedDOMComponentsWithTag(/* [1] */ tree, String tagName);
225205

226206
/// Render a Component into a detached DOM node in the document.
227207
@JS('React.addons.TestUtils.renderIntoDocument')

pubspec.yaml

+2-5
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,11 @@ dependencies:
88
js: ^0.6.0
99
meta: ^1.6.0
1010
dev_dependencies:
11-
args: ">=1.5.1 <3.0.0"
11+
args: ^2.0.0
1212
build_runner: ^2.1.2
1313
build_test: ^2.1.3
1414
build_web_compilers: ^3.0.0
1515
dependency_validator: ^3.2.2
1616
matcher: ^0.12.11
17-
mockito: '>=5.0.0 <5.3.0' # pin to workaround https://github.com/dart-lang/mockito/issues/552
17+
mockito: ^5.3.1
1818
test: ^1.17.12
19-
dependency_validator:
20-
ignore:
21-
- mockito

test/lifecycle_test.dart

+21-7
Original file line numberDiff line numberDiff line change
@@ -723,8 +723,12 @@ void sharedLifecycleTests<T extends react.Component>({
723723
'newProp': 'new',
724724
};
725725

726-
final Map initialPropsWithDefaults = unmodifiableMap({}..addAll(defaultProps)..addAll(initialProps));
727-
final Map newPropsWithDefaults = unmodifiableMap({}..addAll(defaultProps)..addAll(newProps));
726+
final Map initialPropsWithDefaults = unmodifiableMap({}
727+
..addAll(defaultProps)
728+
..addAll(initialProps));
729+
final Map newPropsWithDefaults = unmodifiableMap({}
730+
..addAll(defaultProps)
731+
..addAll(newProps));
728732

729733
const Map expectedState = const {};
730734

@@ -871,7 +875,9 @@ void sharedLifecycleTests<T extends react.Component>({
871875
'ref': ((ref) => component = ref),
872876
};
873877

874-
var initialProps = new Map.from(defaultProps)..addAll(initialContext)..addAll({'children': const []});
878+
var initialProps = new Map.from(defaultProps)
879+
..addAll(initialContext)
880+
..addAll({'children': const []});
875881
// Add the 'ref' prop separately so it isn't an expected prop since React removes it internally
876882
var initialPropsWithRef = new Map.from(initialProps)..addAll(refMap);
877883

@@ -935,8 +941,12 @@ void sharedLifecycleTests<T extends react.Component>({
935941
const Map initialProps = const {'initialProp': 'initial', 'children': const []};
936942
const Map newProps = const {'newProp': 'new', 'children': const []};
937943

938-
final Map initialPropsWithDefaults = unmodifiableMap({}..addAll(defaultProps)..addAll(initialProps));
939-
final Map newPropsWithDefaults = unmodifiableMap({}..addAll(defaultProps)..addAll(newProps));
944+
final Map initialPropsWithDefaults = unmodifiableMap({}
945+
..addAll(defaultProps)
946+
..addAll(initialProps));
947+
final Map newPropsWithDefaults = unmodifiableMap({}
948+
..addAll(defaultProps)
949+
..addAll(newProps));
940950

941951
const Map expectedState = const {};
942952
final dynamic expectedContext = isComponent2 ? null : const {};
@@ -1205,8 +1215,12 @@ void sharedLifecycleTests<T extends react.Component>({
12051215
initialProps = unmodifiableMap({'getInitialState': (_) => initialState, 'initialState': (_) => initialState});
12061216
newState1 = {'foo': 'bar'};
12071217
newState2 = {'baz': 'foobar'};
1208-
expectedState1 = {}..addAll(initialState)..addAll(newState1);
1209-
expectedState2 = {}..addAll(expectedState1)..addAll(newState2);
1218+
expectedState1 = {}
1219+
..addAll(initialState)
1220+
..addAll(newState1);
1221+
expectedState2 = {}
1222+
..addAll(expectedState1)
1223+
..addAll(newState2);
12101224

12111225
component = getDartComponent(render(LifecycleTest(initialProps)));
12121226
component.lifecycleCalls.clear();

0 commit comments

Comments
 (0)