11import { describe , expect , it } from "vitest" ;
2- import { formatModelSlug , parseModelListResponse } from "./modelListResponse" ;
3-
4- describe ( "formatModelSlug" , ( ) => {
5- it ( "capitalizes plain segments" , ( ) => {
6- expect ( formatModelSlug ( "codex-mini" ) ) . toBe ( "Codex-Mini" ) ;
7- } ) ;
8-
9- it ( "uppercases known acronyms" , ( ) => {
10- expect ( formatModelSlug ( "gpt-5.3-codex" ) ) . toBe ( "GPT-5.3-Codex" ) ;
11- } ) ;
12-
13- it ( "leaves version-like segments unchanged" , ( ) => {
14- expect ( formatModelSlug ( "gpt-5.1-codex-max" ) ) . toBe ( "GPT-5.1-Codex-Max" ) ;
15- } ) ;
16-
17- it ( "handles a version-only slug" , ( ) => {
18- expect ( formatModelSlug ( "gpt-5.2" ) ) . toBe ( "GPT-5.2" ) ;
19- } ) ;
20- it ( "is case-insensitive for acronym detection" , ( ) => {
21- expect ( formatModelSlug ( "GPT-5.3-codex" ) ) . toBe ( "GPT-5.3-Codex" ) ;
22- expect ( formatModelSlug ( "Gpt-5.3-codex" ) ) . toBe ( "GPT-5.3-Codex" ) ;
23- } ) ;
24-
25- it ( "returns empty string for non-string input" , ( ) => {
26- expect ( formatModelSlug ( null ) ) . toBe ( "" ) ;
27- expect ( formatModelSlug ( undefined ) ) . toBe ( "" ) ;
28- expect ( formatModelSlug ( 42 ) ) . toBe ( "" ) ;
29- } ) ;
30-
31- it ( "returns empty string for blank strings" , ( ) => {
32- expect ( formatModelSlug ( "" ) ) . toBe ( "" ) ;
33- expect ( formatModelSlug ( " " ) ) . toBe ( "" ) ;
34- } ) ;
35-
36- it ( "handles a single segment" , ( ) => {
37- expect ( formatModelSlug ( "codex" ) ) . toBe ( "Codex" ) ;
38- expect ( formatModelSlug ( "gpt" ) ) . toBe ( "GPT" ) ;
39- } ) ;
40- } ) ;
2+ import { parseModelListResponse } from "./modelListResponse" ;
413
424describe ( "parseModelListResponse" , ( ) => {
435 it ( "uses displayName when present" , ( ) => {
@@ -52,34 +14,34 @@ describe("parseModelListResponse", () => {
5214 expect ( model . displayName ) . toBe ( "GPT-5.3-Codex-Spark" ) ;
5315 } ) ;
5416
55- it ( "formats the slug when displayName is missing" , ( ) => {
17+ it ( "uses the raw model slug when displayName is missing" , ( ) => {
5618 const response = {
5719 result : {
5820 data : [ { id : "m1" , model : "gpt-5.3-codex" } ] ,
5921 } ,
6022 } ;
6123 const [ model ] = parseModelListResponse ( response ) ;
62- expect ( model . displayName ) . toBe ( "GPT -5.3-Codex " ) ;
24+ expect ( model . displayName ) . toBe ( "gpt -5.3-codex " ) ;
6325 } ) ;
6426
65- it ( "formats the slug when displayName is an empty string" , ( ) => {
27+ it ( "uses the raw model slug when displayName is an empty string" , ( ) => {
6628 const response = {
6729 result : {
6830 data : [ { id : "m1" , model : "gpt-5.1-codex-mini" , displayName : "" } ] ,
6931 } ,
7032 } ;
7133 const [ model ] = parseModelListResponse ( response ) ;
72- expect ( model . displayName ) . toBe ( "GPT -5.1-Codex-Mini " ) ;
34+ expect ( model . displayName ) . toBe ( "gpt -5.1-codex-mini " ) ;
7335 } ) ;
7436
75- it ( "formats the slug when displayName equals the model slug" , ( ) => {
37+ it ( "preserves displayName when it equals the model slug" , ( ) => {
7638 const response = {
7739 result : {
7840 data : [ { id : "m1" , model : "gpt-5.3-codex" , displayName : "gpt-5.3-codex" } ] ,
7941 } ,
8042 } ;
8143 const [ model ] = parseModelListResponse ( response ) ;
82- expect ( model . displayName ) . toBe ( "GPT -5.3-Codex " ) ;
44+ expect ( model . displayName ) . toBe ( "gpt -5.3-codex " ) ;
8345 } ) ;
8446
8547 it ( "preserves displayName when it differs from the slug" , ( ) => {
@@ -93,6 +55,6 @@ describe("parseModelListResponse", () => {
9355 } ;
9456 const models = parseModelListResponse ( response ) ;
9557 expect ( models [ 0 ] . displayName ) . toBe ( "GPT-5.3-Codex-Spark" ) ;
96- expect ( models [ 1 ] . displayName ) . toBe ( "GPT -5.2-Codex " ) ;
58+ expect ( models [ 1 ] . displayName ) . toBe ( "gpt -5.2-codex " ) ;
9759 } ) ;
9860} ) ;
0 commit comments