Skip to content

Commit 606e847

Browse files
committed
test: select after upsert
1 parent 8c3d84d commit 606e847

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/mock_supabase_http_client_test.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,20 @@ void main() {
5050
expect(postsUfterUpdate.first, {'id': 1, 'title': 'Updated post'});
5151
});
5252

53+
test('Upsert then select', () async {
54+
// Test upserting a record
55+
await mockSupabase
56+
.from('posts')
57+
.upsert({'id': 1, 'title': 'Initial post'});
58+
final posts = await mockSupabase.from('posts').select();
59+
expect(posts.first, {'id': 1, 'title': 'Initial post'});
60+
final postsAfterUpdate = await mockSupabase
61+
.from('posts')
62+
.upsert({'id': 1, 'title': 'Updated post'}).select();
63+
expect(postsAfterUpdate.length, 1);
64+
expect(postsAfterUpdate.first, {'id': 1, 'title': 'Updated post'});
65+
});
66+
5367
test('Update', () async {
5468
// Test updating a record
5569
await mockSupabase

0 commit comments

Comments
 (0)