@@ -35,6 +35,15 @@ void main() {
3535 expect (posts.first, {'title' : 'Hello, world!' });
3636 });
3737
38+ test ('Insert then select' , () async {
39+ // Test inserting a record
40+ final posts = await mockSupabase
41+ .from ('posts' )
42+ .insert ({'title' : 'Hello, world!' }).select ();
43+ expect (posts.length, 1 );
44+ expect (posts.first, {'title' : 'Hello, world!' });
45+ });
46+
3847 test ('Upsert' , () async {
3948 // Test upserting a record
4049 await mockSupabase
@@ -50,6 +59,20 @@ void main() {
5059 expect (postsUfterUpdate.first, {'id' : 1 , 'title' : 'Updated post' });
5160 });
5261
62+ test ('Upsert then select' , () async {
63+ // Test upserting a record
64+ await mockSupabase
65+ .from ('posts' )
66+ .upsert ({'id' : 1 , 'title' : 'Initial post' });
67+ final posts = await mockSupabase.from ('posts' ).select ();
68+ expect (posts.first, {'id' : 1 , 'title' : 'Initial post' });
69+ final postsAfterUpdate = await mockSupabase
70+ .from ('posts' )
71+ .upsert ({'id' : 1 , 'title' : 'Updated post' }).select ();
72+ expect (postsAfterUpdate.length, 1 );
73+ expect (postsAfterUpdate.first, {'id' : 1 , 'title' : 'Updated post' });
74+ });
75+
5376 test ('Update' , () async {
5477 // Test updating a record
5578 await mockSupabase
@@ -63,6 +86,20 @@ void main() {
6386 expect (posts.first, {'id' : 1 , 'title' : 'Updated title' });
6487 });
6588
89+ test ('Update then select' , () async {
90+ // Test updating a record
91+ await mockSupabase
92+ .from ('posts' )
93+ .insert ({'id' : 1 , 'title' : 'Original title' });
94+ final posts = await mockSupabase
95+ .from ('posts' )
96+ .update ({'title' : 'Updated title' })
97+ .eq ('id' , 1 )
98+ .select ();
99+ expect (posts.length, 1 );
100+ expect (posts.first, {'id' : 1 , 'title' : 'Updated title' });
101+ });
102+
66103 test ('Delete' , () async {
67104 // Test deleting a record
68105 await mockSupabase
@@ -72,6 +109,19 @@ void main() {
72109 final posts = await mockSupabase.from ('posts' ).select ();
73110 expect (posts.length, 0 );
74111 });
112+
113+ test ('Delete then select' , () async {
114+ // Test deleting a record
115+ await mockSupabase
116+ .from ('posts' )
117+ .insert ({'id' : 1 , 'title' : 'To be deleted' });
118+ final deleted =
119+ await mockSupabase.from ('posts' ).delete ().eq ('id' , 1 ).select ();
120+ expect (deleted.length, 1 );
121+ final posts = await mockSupabase.from ('posts' ).select ();
122+ expect (posts.length, 0 );
123+ });
124+
75125 test ('Select all columns' , () async {
76126 // Test selecting all records
77127 await mockSupabase.from ('posts' ).insert ([
0 commit comments