@@ -24,7 +24,16 @@ describe("workspace file previews", () => {
2424 [ "db" , "sqlite" , "application/vnd.sqlite3" ] ,
2525 ] ) ( "recognizes binary preview %s" , ( extension , kind , mimeType ) => {
2626 const name = `files#draft/sample.${ extension . toUpperCase ( ) } ` ;
27- expect ( filePreviewKind ( { name, mimeType : "application/octet-stream" } ) ) . toBe ( kind ) ;
27+ for ( const genericMime of [
28+ "" ,
29+ "application/octet-stream" ,
30+ "binary/octet-stream" ,
31+ "application/unknown" ,
32+ " APPLICATION/UNKNOWN ; charset=utf-8" ,
33+ "text/plain" ,
34+ ] ) {
35+ expect ( filePreviewKind ( { name, mimeType : genericMime } ) ) . toBe ( kind ) ;
36+ }
2837 expect ( filePreviewKind ( { name : "download" , mimeType } ) ) . toBe ( kind ) ;
2938 expect ( isWorkspacePreviewEntryPath ( name ) ) . toBe ( true ) ;
3039 expect ( isWorkspacePreviewEntryPath ( `${ name } ?download=1` ) ) . toBe ( false ) ;
@@ -79,7 +88,16 @@ describe("workspace file previews", () => {
7988 [ "analysis.ipynb" , "ipynb" , "application/x-ipynb+json" ] ,
8089 ] ) ( "recognizes Office assets at literal path %s" , ( name , kind , mimeType ) => {
8190 expect ( officePreviewKind ( { name } ) ) . toBe ( kind ) ;
82- expect ( filePreviewKind ( { name, mimeType : "application/octet-stream" } ) ) . toBe ( kind ) ;
91+ for ( const genericMime of [
92+ "" ,
93+ "application/octet-stream" ,
94+ "binary/octet-stream" ,
95+ "application/unknown" ,
96+ " APPLICATION/UNKNOWN ; charset=utf-8" ,
97+ "text/plain" ,
98+ ] ) {
99+ expect ( filePreviewKind ( { name, mimeType : genericMime } ) ) . toBe ( kind ) ;
100+ }
83101 expect ( isWorkspacePreviewEntryPath ( name ) ) . toBe ( true ) ;
84102 expect ( hostPreviewMimeTypeFromExtension ( `.${ kind } ` ) ) . toBe ( mimeType ) ;
85103 expect ( filePreviewKind ( { name : "download" , mimeType } ) ) . toBe ( kind ) ;
0 commit comments