-
Notifications
You must be signed in to change notification settings - Fork 3.9k
/
set_options_test.dart
49 lines (44 loc) 路 1.47 KB
/
set_options_test.dart
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
// ignore_for_file: require_trailing_commas
// Copyright 2020, the Chromium project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:cloud_firestore_platform_interface/cloud_firestore_platform_interface.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('$SetOptions', () {
test('throws if no options are provided', () {
expect(SetOptions.new, throwsAssertionError);
});
test('throws if mergeFields contains invalid values', () {
expect(() => SetOptions(mergeFields: [123]), throwsAssertionError);
expect(() => SetOptions(mergeFields: [{}]), throwsAssertionError);
});
test('throws if merge is set with mergeFields', () {
expect(
() => SetOptions(merge: true, mergeFields: ['123']),
throwsAssertionError,
);
expect(
() => SetOptions(merge: false, mergeFields: ['123']),
throwsAssertionError,
);
});
test('mergeFields are set as a [FieldPath] & preserve current FieldPaths',
() {
expect(
SetOptions(
mergeFields: [
'foo.bar',
FieldPath(const ['foo', 'bar', 'baz'])
],
).mergeFields,
equals(
[
FieldPath(const ['foo', 'bar']),
FieldPath(const ['foo', 'bar', 'baz']),
],
),
);
});
});
}