Skip to content

Commit c99bb9c

Browse files
committed
store test [nfc]: Give a logical order to retry-on-failure tests
This will help keep these test cases readable when we add a bunch more alongside them.
1 parent 250e3c6 commit c99bb9c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

test/model/store_test.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -728,23 +728,25 @@ void main() {
728728
});
729729
}
730730

731-
test('retries on Server5xxException', () {
732-
checkRetry(() => connection.prepare(httpStatus: 500, body: 'splat'));
733-
});
731+
// These cases are ordered by how far the request got before it failed.
734732

735733
test('retries on NetworkException', () {
736734
checkRetry(() => connection.prepare(exception: Exception("failed")));
737735
});
738736

739-
test('retries on generic ZulipApiException', () {
740-
checkRetry(() => connection.prepare(httpStatus: 400, json: {
741-
'result': 'error', 'code': 'BAD_REQUEST', 'msg': 'Bad request'}));
737+
test('retries on Server5xxException', () {
738+
checkRetry(() => connection.prepare(httpStatus: 500, body: 'splat'));
742739
});
743740

744741
test('retries on MalformedServerResponseException', () {
745742
checkRetry(() => connection.prepare(httpStatus: 200, body: 'nonsense'));
746743
});
747744

745+
test('retries on generic ZulipApiException', () {
746+
checkRetry(() => connection.prepare(httpStatus: 400, json: {
747+
'result': 'error', 'code': 'BAD_REQUEST', 'msg': 'Bad request'}));
748+
});
749+
748750
group('report error', () {
749751
String? lastReportedError;
750752
String? takeLastReportedError() {

0 commit comments

Comments
 (0)