diff --git a/crates/nu-cli/tests/format_conversions/eml.rs b/crates/nu-cli/tests/format_conversions/eml.rs index bb5111c5b..df32113e0 100644 --- a/crates/nu-cli/tests/format_conversions/eml.rs +++ b/crates/nu-cli/tests/format_conversions/eml.rs @@ -2,7 +2,7 @@ use nu_test_support::{nu, pipeline}; const TEST_CWD: &str = "tests/fixtures/formats"; -// The To field in this email is just "username@domain.com", which gets parsed out as the Address. The Name is empty. +// The To field in this email is just "to@example.com", which gets parsed out as the Address. The Name is empty. #[test] fn from_eml_get_to_field() { let actual = nu!( @@ -17,7 +17,7 @@ fn from_eml_get_to_field() { ) ); - assert_eq!(actual.out, "username@domain.com"); + assert_eq!(actual.out, "to@example.com"); let actual = nu!( cwd: TEST_CWD, @@ -34,7 +34,7 @@ fn from_eml_get_to_field() { assert_eq!(actual.out, ""); } -// The Reply-To field in this email is "aw-confirm@ebay.com" , meaning both the Name and Address values are identical. +// The Reply-To field in this email is "replyto@example.com" , meaning both the Name and Address values are identical. #[test] fn from_eml_get_replyto_field() { let actual = nu!( @@ -49,7 +49,7 @@ fn from_eml_get_replyto_field() { ) ); - assert_eq!(actual.out, "aw-confirm@ebay.com"); + assert_eq!(actual.out, "replyto@example.com"); let actual = nu!( cwd: TEST_CWD, @@ -63,10 +63,9 @@ fn from_eml_get_replyto_field() { ) ); - assert_eq!(actual.out, "aw-confirm@ebay.com"); + assert_eq!(actual.out, "replyto@example.com"); } -// The Reply-To field in this email is "aw-confirm@ebay.com" , meaning both the Name and Address values are identical. #[test] fn from_eml_get_subject_field() { let actual = nu!( @@ -80,5 +79,21 @@ fn from_eml_get_subject_field() { ) ); - assert_eq!(actual.out, "Billing Issues"); + assert_eq!(actual.out, "Test Message"); +} + +#[test] +fn from_eml_get_another_header_field() { + let actual = nu!( + cwd: TEST_CWD, + pipeline( + r#" + open sample.eml + | get MIME-Version + | echo $it + "# + ) + ); + + assert_eq!(actual.out, "1.0"); } diff --git a/tests/fixtures/formats/sample.eml b/tests/fixtures/formats/sample.eml index 456284d6c..d17e28868 100644 --- a/tests/fixtures/formats/sample.eml +++ b/tests/fixtures/formats/sample.eml @@ -1,97 +1,20 @@ -Return-Path: -X-Original-To: username@domain.com -Delivered-To: username@domain.com -Received: from 81.18.87.130 (unknown [81.18.87.190]) - by spanky.domain.com (Postfix) with SMTP id CCC115378FC - for ; Sat, 27 Nov 2004 15:33:24 -0500 (EST) -Received: from 20.84.152.113 by 65.23.81.142; Sat, 27 Nov 2004 15:24:27 -0500 -Message-ID: -From: "aw-confirm@ebay.com" -Reply-To: "aw-confirm@ebay.com" -To: username@domain.com -Subject: Billing Issues -Date: Sun, 28 Nov 2004 00:30:27 +0400 MIME-Version: 1.0 -Content-Type: multipart/alternative; - boundary="--591699981497957" -X-Priority: 3 -X-CS-IP: 224.248.218.116 -Status: O -X-Status: -X-Keywords: -X-UID: 1 +Date: Fri, 28 Aug 2020 13:59:02 -0700 +Message-ID: +Subject: Test Message +From: "from@example.com" +Reply-To: "replyto@example.com" +To: to@example.com +Content-Type: multipart/alternative; boundary="0000000000009d71fb05adf6528a" -----591699981497957 -Content-Type: text/html; -Content-Transfer-Encoding: quoted-printable +--0000000000009d71fb05adf6528a +Content-Type: text/plain; charset="UTF-8" - -

-

-


-Dear valued -eBay member:
-
-We recently have determined that different computers -have logged onto your eBay account, and multiple -password failures were present before the logons. We -now need you to re-confirm your account information to -us. If this is not completed by November 30, -2004, we will be forced to suspend your -account indefinitely, as it may have been used for -fraudulent purposes. We thank you for your cooperation -in this manner.
-

To confirm your eBay records click here:
- http://cgi1.ebay.com/aw-cgi/ebayISAPI.dll?UPdate

-

We appreciate your -support and understanding, as we work together to keep -eBay a safe place to trade.
-Thank you for your patience in this matter.

-
-

-

Trust and Safety -Department
- eBay Inc.

-

Please do -not reply to this e-mail as this is only a -notification. Mail sent to this address cannot be -answered.

-

Copyright 1995-2004 eBay -Inc. All Rights Reserved. Designated trademarks -and brands are the property of their respective -owners. Use of this Web site constitutes acceptance of -the eBay User -Agreement and Privacy -Policy. Designated trademarks and -brands are the property of their respective owners. -eBay and the eBay logo are trademarks of eBay Inc. -eBay is located at 2145 Hamilton Avenue, San Jose, CA -95125.
-

- +Test Message +--0000000000009d71fb05adf6528a +Content-Type: text/html; charset="UTF-8" +
Test Message
-----591699981497957-- +--0000000000009d71fb05adf6528a--