diff --git a/test/unit/network_utils_spec.js b/test/unit/network_utils_spec.js index 56de74408..6ed8e7de1 100644 --- a/test/unit/network_utils_spec.js +++ b/test/unit/network_utils_spec.js @@ -174,11 +174,29 @@ describe('network_utils', function() { } })).toEqual('filename.pdf'); + expect(extractFilenameFromHeader((headerName) => { + if (headerName === 'Content-Disposition') { + return 'attachment; filename="filename.pdf and spaces.pdf"'; + } + })).toEqual('filename.pdf and spaces.pdf'); + + expect(extractFilenameFromHeader((headerName) => { + if (headerName === 'Content-Disposition') { + return 'attachment; filename="tl;dr.pdf"'; + } + })).toEqual('tl;dr.pdf'); + expect(extractFilenameFromHeader((headerName) => { if (headerName === 'Content-Disposition') { return 'attachment; filename=filename.pdf'; } })).toEqual('filename.pdf'); + + expect(extractFilenameFromHeader((headerName) => { + if (headerName === 'Content-Disposition') { + return 'attachment; filename=filename.pdf someotherparam'; + } + })).toEqual('filename.pdf'); }); it('gets the filename from the response header (RFC 6266)', function() {