@@ -51,19 +51,22 @@ void main() {
5151 });
5252
5353 group ('$Scope $SentryAttachment tests' , () {
54+ late Fixture fixture;
55+
56+ setUp (() {
57+ fixture = Fixture ();
58+ });
59+
5460 test ('Sending with attachments' , () async {
55- final options = SentryOptions (dsn: fakeDsn);
56- final transport = MockTransport ();
57- options.transport = transport;
58- final hub = Hub (options);
59- await hub.captureEvent (SentryEvent (), withScope: (scope) {
61+ final sut = fixture.getSut ();
62+ await sut.captureEvent (SentryEvent (), withScope: (scope) {
6063 scope.addAttachment (
6164 SentryAttachment .fromIntList ([0 , 0 , 0 , 0 ], 'test.txt' ),
6265 );
6366 });
64- expect (transport.envelopes.length, 1 );
65- expect (transport.envelopes.first.items.length, 2 );
66- final attachmentEnvelope = transport.envelopes.first.items[1 ];
67+ expect (fixture. transport.envelopes.length, 1 );
68+ expect (fixture. transport.envelopes.first.items.length, 2 );
69+ final attachmentEnvelope = fixture. transport.envelopes.first.items[1 ];
6770 expect (
6871 attachmentEnvelope.header.attachmentType,
6972 SentryAttachment .typeAttachmentDefault,
@@ -83,3 +86,13 @@ void main() {
8386 });
8487 });
8588}
89+
90+ class Fixture {
91+ MockTransport transport = MockTransport ();
92+
93+ Hub getSut () {
94+ final options = SentryOptions (dsn: fakeDsn);
95+ options.transport = transport;
96+ return Hub (options);
97+ }
98+ }
0 commit comments