(t *testing.T)
| 1981 | } |
| 1982 | |
| 1983 | func TestValidateTitle(t *testing.T) { |
| 1984 | tests := []struct { |
| 1985 | name string |
| 1986 | serverDetail apiv0.ServerJSON |
| 1987 | expectedError string |
| 1988 | }{ |
| 1989 | { |
| 1990 | name: "Valid title without MCP suffix", |
| 1991 | serverDetail: apiv0.ServerJSON{ |
| 1992 | Schema: model.CurrentSchemaURL, |
| 1993 | Name: "com.example/test-server", |
| 1994 | Description: "A test server", |
| 1995 | Title: "GitHub", |
| 1996 | Repository: &model.Repository{ |
| 1997 | URL: "https://github.com/owner/repo", |
| 1998 | Source: "github", |
| 1999 | }, |
| 2000 | Version: "1.0.0", |
| 2001 | }, |
| 2002 | expectedError: "", |
| 2003 | }, |
| 2004 | { |
| 2005 | name: "Valid title with multiple words", |
| 2006 | serverDetail: apiv0.ServerJSON{ |
| 2007 | Schema: model.CurrentSchemaURL, |
| 2008 | Name: "com.example/test-server", |
| 2009 | Description: "A test server", |
| 2010 | Title: "Weather API", |
| 2011 | Repository: &model.Repository{ |
| 2012 | URL: "https://github.com/owner/repo", |
| 2013 | Source: "github", |
| 2014 | }, |
| 2015 | Version: "1.0.0", |
| 2016 | }, |
| 2017 | expectedError: "", |
| 2018 | }, |
| 2019 | { |
| 2020 | name: "Empty title is allowed (optional field)", |
| 2021 | serverDetail: apiv0.ServerJSON{ |
| 2022 | Schema: model.CurrentSchemaURL, |
| 2023 | Name: "com.example/test-server", |
| 2024 | Description: "A test server", |
| 2025 | Title: "", |
| 2026 | Repository: &model.Repository{ |
| 2027 | URL: "https://github.com/owner/repo", |
| 2028 | Source: "github", |
| 2029 | }, |
| 2030 | Version: "1.0.0", |
| 2031 | }, |
| 2032 | expectedError: "", |
| 2033 | }, |
| 2034 | { |
| 2035 | name: "Allows title with 'MCP Server' suffix", |
| 2036 | serverDetail: apiv0.ServerJSON{ |
| 2037 | Schema: model.CurrentSchemaURL, |
| 2038 | Name: "com.example/test-server", |
| 2039 | Description: "A test server", |
| 2040 | Title: "GitHub MCP Server", |
nothing calls this directly
no test coverage detected
searching dependent graphs…