diff --git a/templates/dart/test/channel_test.dart.twig b/templates/dart/test/channel_test.dart.twig deleted file mode 100644 index ff066fa09a..0000000000 --- a/templates/dart/test/channel_test.dart.twig +++ /dev/null @@ -1,161 +0,0 @@ -import 'package:{{ language.params.packageName }}/{{ language.params.packageName }}.dart'; -{% if 'dart' in language.params.packageName %} -import 'package:test/test.dart'; -{% else %} -import 'package:flutter_test/flutter_test.dart'; -{% endif %} - -void main() { - group('database()', () { - test('returns database channel builder', () { - final builder = Channel.database(); - expect(builder.channel, 'databases.*'); - }); - - test('returns database channel with specific ID', () { - final builder = Channel.database('db1'); - expect(builder.channel, 'databases.db1'); - }); - - test('returns database channel with collection and document', () { - final channel = Channel.database('db1').collection('col1').document('doc1'); - expect(channel.channel, 'databases.db1.collections.col1.documents.doc1'); - }); - - test('returns database channel with action', () { - final channel = Channel.database('db1').collection('col1').document('doc1').create(); - expect(channel.toString(), 'databases.db1.collections.col1.documents.doc1.create'); - }); - - test('returns database channel with upsert action', () { - final channel = Channel.database('db1').collection('col1').document('doc1').upsert(); - expect(channel.toString(), 'databases.db1.collections.col1.documents.doc1.upsert'); - }); - }); - - group('tablesdb()', () { - test('returns tablesdb channel builder', () { - final builder = Channel.tablesdb(); - expect(builder.channel, 'tablesdb.*'); - }); - - test('returns tablesdb channel with specific ID', () { - final builder = Channel.tablesdb('db1'); - expect(builder.channel, 'tablesdb.db1'); - }); - - test('returns tablesdb channel with table and row', () { - final channel = Channel.tablesdb('db1').table('table1').row('row1'); - expect(channel.channel, 'tablesdb.db1.tables.table1.rows.row1'); - }); - - test('returns tablesdb channel with action', () { - final channel = Channel.tablesdb('db1').table('table1').row('row1').update(); - expect(channel.toString(), 'tablesdb.db1.tables.table1.rows.row1.update'); - }); - }); - - group('account()', () { - test('returns account channel', () { - expect(Channel.account(), 'account'); - }); - }); - - group('bucket()', () { - test('returns buckets channel builder', () { - final builder = Channel.bucket(); - expect(builder.channel, 'buckets.*'); - }); - - test('returns buckets channel with specific ID', () { - final builder = Channel.bucket('bucket1'); - expect(builder.channel, 'buckets.bucket1'); - }); - - test('returns buckets channel with file', () { - final channel = Channel.bucket('bucket1').file('file1'); - expect(channel.channel, 'buckets.bucket1.files.file1'); - }); - - test('returns buckets channel with action', () { - final channel = Channel.bucket('bucket1').file('file1').delete(); - expect(channel.toString(), 'buckets.bucket1.files.file1.delete'); - }); - }); - - group('functions()', () { - test('returns functions channel builder', () { - final builder = Channel.function(); - expect(builder.channel, 'functions.*'); - }); - - test('returns functions channel with specific ID', () { - final builder = Channel.function('func1'); - expect(builder.channel, 'functions.func1'); - }); - }); - - group('executions()', () { - test('returns executions channel builder', () { - final builder = Channel.execution(); - expect(builder.channel, 'executions.*'); - }); - - test('returns executions channel with specific ID', () { - final builder = Channel.execution('exec1'); - expect(builder.channel, 'executions.exec1'); - }); - }); - - group('teams()', () { - test('returns teams channel builder', () { - final builder = Channel.team(); - expect(builder.channel, 'teams.*'); - }); - - test('returns teams channel with specific team ID', () { - final builder = Channel.team('team1'); - expect(builder.channel, 'teams.team1'); - }); - - test('returns teams channel with action', () { - final channel = Channel.team('team1').create(); - expect(channel.toString(), 'teams.team1.create'); - }); - }); - - group('memberships()', () { - test('returns memberships channel builder', () { - final builder = Channel.membership(); - expect(builder.channel, 'memberships.*'); - }); - - test('returns memberships channel with specific membership ID', () { - final builder = Channel.membership('membership1'); - expect(builder.channel, 'memberships.membership1'); - }); - - test('returns memberships channel with action', () { - final channel = Channel.membership('membership1').update(); - expect(channel.toString(), 'memberships.membership1.update'); - }); - }); - - group('global events', () { - test('returns documents channel', () { - expect(Channel.documents, 'documents'); - }); - - test('returns rows channel', () { - expect(Channel.rows, 'rows'); - }); - - test('returns files channel', () { - expect(Channel.files, 'files'); - }); - - test('returns executions channel', () { - expect(Channel.executions, 'executions'); - }); - }); -} \ No newline at end of file diff --git a/templates/dart/test/services/service_test.dart.twig b/templates/dart/test/services/service_test.dart.twig index e5eb5984ce..f01a391b96 100644 --- a/templates/dart/test/services/service_test.dart.twig +++ b/templates/dart/test/services/service_test.dart.twig @@ -102,7 +102,11 @@ void main() { {%- if method.type == 'location' ~%} expect(response, isA()); {%~ endif ~%}{%~ if method.responseModel and method.responseModel != 'any' ~%} + {% if method.responseModels|length > 1 %} + expect(response, isA>()); + {% else %} expect(response, isA()); + {% endif %} {%~ endif ~%} });