mirror of
				https://github.com/aclindsa/moneygo.git
				synced 2025-10-30 09:33:25 -04:00 
			
		
		
		
	testing: Test deleting transactions
This commit is contained in:
		| @@ -246,7 +246,32 @@ func TestUpdateTransaction(t *testing.T) { | |||||||
| 			} else { | 			} else { | ||||||
| 				t.Fatalf("Unexpected error updating zero splits") | 				t.Fatalf("Unexpected error updating zero splits") | ||||||
| 			} | 			} | ||||||
|  | 		} | ||||||
|  | 	}) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func TestDeleteTransaction(t *testing.T) { | ||||||
|  | 	RunWith(t, &data[0], func(t *testing.T, d *TestData) { | ||||||
|  | 		for i := 1; i < len(data[0].transactions); i++ { | ||||||
|  | 			orig := data[0].transactions[i] | ||||||
|  | 			curr := d.transactions[i] | ||||||
|  |  | ||||||
|  | 			err := deleteTransaction(d.clients[orig.UserId], &curr) | ||||||
|  | 			if err != nil { | ||||||
|  | 				t.Fatalf("Error deleting transaction: %s\n", err) | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			_, err = getTransaction(d.clients[orig.UserId], curr.TransactionId) | ||||||
|  | 			if err == nil { | ||||||
|  | 				t.Fatalf("Expected error fetching deleted transaction") | ||||||
|  | 			} | ||||||
|  | 			if herr, ok := err.(*handlers.Error); ok { | ||||||
|  | 				if herr.ErrorId != 3 { // Invalid requeset | ||||||
|  | 					t.Fatalf("Unexpected API error fetching deleted transaction: %s", herr) | ||||||
|  | 				} | ||||||
|  | 			} else { | ||||||
|  | 				t.Fatalf("Unexpected error fetching deleted transaction") | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 	}) | 	}) | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user