feat: initialize CollabTableServer with models, sync, and notification handling
- Add go.mod and go.sum for dependency management - Implement models for List, Field, Item, ItemValue, SyncRequest, SyncResponse, and NotificationEvent - Create notification handling functions including enqueueNotification and ignoreNotificationError - Implement sync functionality to handle data synchronization between client and server - Add web data handling and notification polling endpoints - Include tests for timestamp normalization and sync logic - Embed web assets for serving the frontend application
This commit is contained in:
1 parent
e12940fef0
commit
cac2faae2e
41 files changed
+2535
-5502
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTimestampAcceptsNumericAndStringValues(t *testing.T) {
|
||||
for _, input := range []string{`1700000000000`, `"1700000000000"`} {
|
||||
var timestamp Timestamp
|
||||
if err := json.Unmarshal([]byte(input), ×tamp); err != nil {
|
||||
t.Fatalf("unmarshal %s: %v", input, err)
|
||||
}
|
||||
if timestamp != 1700000000000 {
|
||||
t.Fatalf("unmarshal %s = %d, want 1700000000000", input, timestamp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestTimestampAcceptsNullAsZero(t *testing.T) {
|
||||
var timestamp Timestamp = 42
|
||||
if err := json.Unmarshal([]byte(`null`), ×tamp); err != nil {
|
||||
t.Fatalf("unmarshal null: %v", err)
|
||||
}
|
||||
if timestamp != 0 {
|
||||
t.Fatalf("null timestamp = %d, want 0", timestamp)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user