|
36 | 36 | @ExtendWith(MetafixToDo.Extension.class)
|
37 | 37 | public class MetafixMethodTest {
|
38 | 38 |
|
| 39 | + private static final String YOUTUBE_URL = "https://www.youtube.com/watch?v=daLgsPSvD9A"; |
| 40 | + |
39 | 41 | @Mock
|
40 | 42 | private StreamReceiver streamReceiver;
|
41 | 43 |
|
@@ -4085,21 +4087,30 @@ public void shouldTransformStringToBase64() {
|
4085 | 4087 | }
|
4086 | 4088 |
|
4087 | 4089 | @Test
|
4088 |
| - public void shouldTransformUrlToBase64() { |
| 4090 | + public void shouldTransformUrlSafeToBase64() { |
| 4091 | + urlToBase64(",url_safe:'true'", "aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g_dj1kYUxnc1BTdkQ5QQ=="); |
| 4092 | + } |
| 4093 | + |
| 4094 | + @Test |
| 4095 | + public void shouldTransformNotUrlSafeToBase64AsDefault() { |
| 4096 | + urlToBase64("", "aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g/dj1kYUxnc1BTdkQ5QQ=="); |
| 4097 | + } |
| 4098 | + |
| 4099 | + private void urlToBase64(final String option, final String expected) { |
4089 | 4100 | MetafixTestHelpers.assertFix(streamReceiver, Arrays.asList(
|
4090 |
| - "to_base64('data.title', url_safe:'true')" |
| 4101 | + "to_base64('data.title'" + option + ")" |
4091 | 4102 | ),
|
4092 | 4103 | i -> {
|
4093 | 4104 | i.startRecord("1");
|
4094 | 4105 | i.startEntity("data");
|
4095 |
| - i.literal("title", "https://www.youtube.com/watch?v=daLgsPSvD9A"); |
| 4106 | + i.literal("title", YOUTUBE_URL); |
4096 | 4107 | i.endEntity();
|
4097 | 4108 | i.endRecord();
|
4098 | 4109 | },
|
4099 | 4110 | o -> {
|
4100 | 4111 | o.get().startRecord("1");
|
4101 | 4112 | o.get().startEntity("data");
|
4102 |
| - o.get().literal("title", "aHR0cHM6Ly93d3cueW91dHViZS5jb20vd2F0Y2g_dj1kYUxnc1BTdkQ5QQ=="); |
| 4113 | + o.get().literal("title", expected); |
4103 | 4114 | o.get().endEntity();
|
4104 | 4115 | o.get().endRecord();
|
4105 | 4116 | }
|
|
0 commit comments