-- generateClient --.
(t *testing.T)
| 2101 | // -- generateClient --. |
| 2102 | |
| 2103 | func TestGenerateClient(t *testing.T) { |
| 2104 | const sub = auth0.DetectionSub |
| 2105 | |
| 2106 | tests := []struct { |
| 2107 | name string |
| 2108 | input SetupInputs |
| 2109 | reqParams auth0.RequestParams |
| 2110 | wantName string |
| 2111 | wantAppType string |
| 2112 | wantCallbacks []string |
| 2113 | wantLogouts []string |
| 2114 | wantWebOrigins *[]string // Nil means no WebOrigins field set. |
| 2115 | wantOIDC bool |
| 2116 | wantAlgorithm string |
| 2117 | wantMetadataKey string |
| 2118 | }{ |
| 2119 | // Auth0 qs setup --app --type spa --framework react --build-tool vite. |
| 2120 | { |
| 2121 | name: "spa react vite", |
| 2122 | input: SetupInputs{Name: "React App", Port: 5173}, |
| 2123 | reqParams: auth0.RequestParams{ |
| 2124 | AppType: "spa", |
| 2125 | Callbacks: []string{sub}, |
| 2126 | AllowedLogoutURLs: []string{sub}, |
| 2127 | WebOrigins: []string{sub}, |
| 2128 | Name: sub, |
| 2129 | }, |
| 2130 | wantName: "React App", |
| 2131 | wantAppType: "spa", |
| 2132 | wantCallbacks: []string{"http://localhost:5173/callback"}, |
| 2133 | wantLogouts: []string{"http://localhost:5173"}, |
| 2134 | wantWebOrigins: &[]string{"http://localhost:5173"}, |
| 2135 | wantOIDC: true, |
| 2136 | wantAlgorithm: "RS256", |
| 2137 | wantMetadataKey: "created_by", |
| 2138 | }, |
| 2139 | // Auth0 qs setup --app --type spa --framework angular. |
| 2140 | { |
| 2141 | name: "spa angular no web-origins", |
| 2142 | input: SetupInputs{Name: "Angular App", Port: 4200}, |
| 2143 | reqParams: auth0.RequestParams{ |
| 2144 | AppType: "spa", |
| 2145 | Callbacks: []string{sub}, |
| 2146 | AllowedLogoutURLs: []string{sub}, |
| 2147 | Name: sub, |
| 2148 | // No WebOrigins - angular doesn't need them. |
| 2149 | }, |
| 2150 | wantName: "Angular App", |
| 2151 | wantAppType: "spa", |
| 2152 | wantCallbacks: []string{"http://localhost:4200/callback"}, |
| 2153 | wantLogouts: []string{"http://localhost:4200"}, |
| 2154 | wantWebOrigins: nil, |
| 2155 | wantOIDC: true, |
| 2156 | wantAlgorithm: "RS256", |
| 2157 | }, |
| 2158 | // Auth0 qs setup --app --type regular --framework nextjs. |
| 2159 | { |
| 2160 | name: "regular nextjs", |
nothing calls this directly
no test coverage detected