| 1 | package main |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestBumpAndSnapshotSessionClearCarriesCanonicalSessionRef(t *testing.T) { |
| 6 | tab := &WorkspaceTab{ID: "tab-canonical", SessionID: "canonical-a", SessionGeneration: 4} |
| 7 | app := &App{tabs: map[string]*WorkspaceTab{tab.ID: tab}} |
| 8 | |
| 9 | result := app.bumpAndSnapshotSessionClear(tab) |
| 10 | |
| 11 | if result.SessionPath != "" { |
| 12 | t.Fatalf("session path = %q, want empty canonical compatibility path", result.SessionPath) |
| 13 | } |
| 14 | if result.SessionID != "canonical-a" { |
| 15 | t.Fatalf("session id = %q, want canonical-a", result.SessionID) |
| 16 | } |
| 17 | if result.Session == nil || result.Session.HostID != localDesktopHostID || result.Session.SessionID != "canonical-a" { |
| 18 | t.Fatalf("session ref = %#v, want local/canonical-a", result.Session) |
| 19 | } |
| 20 | if result.SessionGeneration != 5 { |
| 21 | t.Fatalf("session generation = %d, want 5", result.SessionGeneration) |
| 22 | } |
| 23 | } |
| 24 |