Skip to content

Commit

Permalink
some more tests. Evil mode not supported yet.
Browse files Browse the repository at this point in the history
  • Loading branch information
dimabershadskiy committed May 12, 2024
1 parent b2e88d8 commit 2c6de0c
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/clink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,45 @@ mod find_and_replace {
"https://youtu.be/dQw4w9WgXcQ?t=69"
);

assert_eq!(
clink.find_and_replace("https://youtu.be/dQw4w9WgXcQ?si=NblIBgit-qHN7MoH&t=69&fbclid=clid",),
"https://youtu.be/dQw4w9WgXcQ?t=69"
);

assert_eq!(
clink.find_and_replace("https://test.test/dQw4w9WgXcQ?si=NblIBgit-qHN7MoH&t=69",),
"https://test.test/dQw4w9WgXcQ?si=NblIBgit-qHN7MoH&t=69"
);

let clink = Clink::new(ClinkConfig::new(Mode::Replace));
assert_eq!(
clink.find_and_replace(
"https://test.test/?fbclid=dsadsa&utm_source=fafa&utm_campaign=fafas&utm_medium=adsa&si=qweasd",
),
"https://test.test/?fbclid=clink&utm_source=clink&utm_campaign=clink&utm_medium=clink&si=qweasd"
);

assert_eq!(
clink.find_and_replace(
"https://youtu.be/?fbclid=dsadsa&utm_source=fafa&utm_campaign=fafas&utm_medium=adsa&si=qweasd",
),
"https://youtu.be/?fbclid=clink&utm_source=clink&utm_campaign=clink&utm_medium=clink&si=clink"
);

let clink = Clink::new(ClinkConfig::new(Mode::YourMom));
assert_eq!(
clink.find_and_replace(
"https://test.test/?si=dsadsa",
),
"https://test.test/?si=dsadsa&utm_source=your_mom"
);

assert_eq!(
clink.find_and_replace(
"https://youtu.be/?si=dsadsa",
),
"https://youtu.be/?utm_source=your_mom"
);
}
}

Expand Down

0 comments on commit 2c6de0c

Please sign in to comment.