summaryrefslogtreecommitdiff
path: root/sent_test.go
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2025-03-05 22:14:27 +0000
committerDmitry Ilvokhin <d@ilvokhin.com>2025-03-05 22:14:27 +0000
commit98da712a92bf3320e4a1045405564e76f58fb514 (patch)
treeca3eaaa8ba6be4085f23a202f1b9e132fa7a46ad /sent_test.go
parent547a44a9fb502a308f596e6ffe1a90bd6c4607bc (diff)
downloadflatbot-98da712a92bf3320e4a1045405564e76f58fb514.tar.gz
flatbot-98da712a92bf3320e4a1045405564e76f58fb514.tar.bz2
flatbot-98da712a92bf3320e4a1045405564e76f58fb514.zip
Basic implemention of the full flow
Diffstat (limited to 'sent_test.go')
-rw-r--r--sent_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/sent_test.go b/sent_test.go
index 64b13d6..5232832 100644
--- a/sent_test.go
+++ b/sent_test.go
@@ -63,6 +63,35 @@ func TestRemoveAlreadySent(t *testing.T) {
}
+func TestRemoveDelisted(t *testing.T) {
+ flats := []flat{
+ flat{
+ ID: 156522206,
+ Price: "£2,500",
+ },
+ flat{
+ ID: 158462822,
+ Price: "£3,000",
+ }}
+ sent := []flat{
+ flat{
+ ID: 156522206,
+ Price: "£2,500",
+ },
+ flat{
+ ID: 157948184,
+ Price: "£2,400",
+ },
+ }
+
+ got := removeDelisted(sent, flats)
+ want := []flat{flat{ID: 156522206, Price: "£2,500"}}
+ if !reflect.DeepEqual(got, want) {
+ t.Errorf("removeDelisted failed: got: %v, want: %v",
+ got, want)
+ }
+}
+
func TestWriteSentNew(t *testing.T) {
tmp := t.TempDir()
filename := filepath.Join(tmp, "sent.json")