Skip to content

Commit

Permalink
Merge pull request #1887 from Expensify/main
Browse files Browse the repository at this point in the history
Update expensify_prod branch
  • Loading branch information
Beamanator authored Oct 8, 2024
2 parents ea39411 + 745389d commit 56ec22e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions test/tests/LibStuffTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ struct LibStuff : tpunit::TestFixture {
TEST(LibStuff::testFirstOfMonth),
TEST(LibStuff::SREMatchTest),
TEST(LibStuff::SREReplaceTest),
TEST(LibStuff::SQResultTest)
TEST(LibStuff::SQResultTest),
TEST(LibStuff::SRedactSensitiveValuesTest)
)
{ }

Expand Down Expand Up @@ -647,7 +648,7 @@ struct LibStuff : tpunit::TestFixture {

// Case sensitive but case doesn't match.
ASSERT_FALSE(SREMatch(".*CAT.*", "this contains cat"));

// Case-insensitive.
ASSERT_TRUE(SREMatch(".*CAT.*", "this contains cat", false));
ASSERT_FALSE(SREMatch(".*CAT.*", "this does not", false));
Expand Down Expand Up @@ -744,4 +745,18 @@ struct LibStuff : tpunit::TestFixture {
db.rollback();
ASSERT_EQUAL(result[0]["coco"], "name1");
}

void SRedactSensitiveValuesTest() {
string logValue = R"({"edits":["test1", "test2", "test3"]})";
SRedactSensitiveValues(logValue);
ASSERT_EQUAL(R"({"edits":["REDACTED"]})", logValue);

logValue = R"({"authToken":"123IMANAUTHTOKEN321"})";
SRedactSensitiveValues(logValue);
ASSERT_EQUAL(R"({"authToken":<REDACTED>)", logValue);

logValue = R"({"html":"private conversation happens here"})";
SRedactSensitiveValues(logValue);
ASSERT_EQUAL(R"({"html":"<REDACTED>"})", logValue);
}
} __LibStuff;

0 comments on commit 56ec22e

Please sign in to comment.