diff options
| author | Dmitry Ilvokhin <d@ilvokhin.com> | 2025-03-01 20:10:26 +0000 |
|---|---|---|
| committer | Dmitry Ilvokhin <d@ilvokhin.com> | 2025-03-02 21:58:24 +0000 |
| commit | 96bcc15d6e3e820309c874fe39df11cb88b30af2 (patch) | |
| tree | 1674002cc4378c5d077c0fe4ca239dd3c4ef9ab0 /flat_test.go | |
| parent | 602dcb4ec617634d1fed182ac0309123992e43c6 (diff) | |
| download | flatbot-96bcc15d6e3e820309c874fe39df11cb88b30af2.tar.gz flatbot-96bcc15d6e3e820309c874fe39df11cb88b30af2.tar.bz2 flatbot-96bcc15d6e3e820309c874fe39df11cb88b30af2.zip | |
Split logic to multiple files
Diffstat (limited to 'flat_test.go')
| -rw-r--r-- | flat_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/flat_test.go b/flat_test.go new file mode 100644 index 0000000..2ac3ddb --- /dev/null +++ b/flat_test.go @@ -0,0 +1,31 @@ +package main + +import ( + "testing" +) + +func TestURL(t *testing.T) { + f := flat{ID: 0, Price: "£1,000"} + got := f.URL() + want := "https://rightmove.co.uk/properties/0" + if got != want { + t.Errorf("URL call failed: got: %v, want: %v", got, want) + } +} + +func TestCompareID(t *testing.T) { + a := flat{ID: 0, Price: "£3,000"} + b := flat{ID: 1, Price: "£1,000"} + got := compareID(a, b) + if got != -1 { + t.Errorf("Wrong compare result: got: %v, want: %v", got, -1) + } + got = compareID(b, a) + if got != 1 { + t.Errorf("Wrong compare result: got: %v, want: %v", got, 1) + } + got = compareID(a, a) + if got != 0 { + t.Errorf("Wrong compare result: got: %v, want: %v", got, 0) + } +} |