Update to new maven and add tests (#2)
Use maven central Signed-off-by: Etzelia <etzelia@hotmail.com> Update to new maven and add tests Signed-off-by: Etzelia <etzelia@hotmail.com> Reviewed-on: https://git.birbmc.com/BirbMC/javacord/pulls/2 Co-Authored-By: Etzelia <etzelia@hotmail.com> Co-Committed-By: Etzelia <etzelia@hotmail.com>pull/3/head
parent
73034785da
commit
51bdafd58f
|
@ -12,6 +12,7 @@ steps:
|
|||
image: gradle:6.6
|
||||
commands:
|
||||
- gradle build
|
||||
- gradle test
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
|
|
|
@ -4,8 +4,8 @@ A small, no-dependency Discord utility library. Currently used for webhooks/embe
|
|||
|
||||
## Releases
|
||||
|
||||
[Reposilite](https://repo.etztech.xyz/releases/xyz/etztech/javacord)
|
||||
[Reposilite](https://mvn.birbmc.com/releases/xyz/etztech/javacord)
|
||||
|
||||
## License
|
||||
|
||||
[MIT](LICENSE``)
|
||||
[MIT](LICENSE)
|
19
build.gradle
19
build.gradle
|
@ -7,6 +7,19 @@ group = 'xyz.etztech'
|
|||
version = '0.2.2'
|
||||
sourceCompatibility = '8'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.6.2")
|
||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.6.2")
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
|
@ -15,10 +28,10 @@ publishing {
|
|||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "etztech"
|
||||
url = "https://repo.etztech.xyz/releases"
|
||||
name = "birbmc"
|
||||
url = "https://mvn.birbmc.com/releases"
|
||||
credentials {
|
||||
username = "etzelia"
|
||||
username = "admin"
|
||||
password = System.getenv("MAVEN_PASSWORD")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
package xyz.etztech;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class JavacordTest {
|
||||
|
||||
@Test
|
||||
void TestEscapeFormat() {
|
||||
String raw = "*Test* **Test** _Test_ __Test__ ~Test~ ~~Test~~ |Test| ||Test||";
|
||||
String escaped = Javacord.escapeFormat(raw);
|
||||
String expected = "\\\\*Test\\\\* \\\\*\\\\*Test\\\\*\\\\* \\\\_Test\\\\_ \\\\_\\\\_Test\\\\_\\\\_ \\\\~Test\\\\~ \\\\~\\\\~Test\\\\~\\\\~ \\\\|Test\\\\| \\\\|\\\\|Test\\\\|\\\\|";
|
||||
Assertions.assertEquals(expected, escaped);
|
||||
}
|
||||
|
||||
@Test
|
||||
void TestEscapeQuote() {
|
||||
String raw = "\"Test\"";
|
||||
String escaped = Javacord.escapeQuote(raw);
|
||||
String expected = "\\\"Test\\\"";
|
||||
Assertions.assertEquals(expected, escaped);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
package xyz.etztech.embed;
|
||||
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class EmbedTest {
|
||||
|
||||
@Test
|
||||
void TestEmbed() {
|
||||
Embed embed = new Embed()
|
||||
.color(0x151515)
|
||||
.author(new Author("Etzelia", "https://etzel.ia", "" ,""))
|
||||
.title("Test \"Title\"")
|
||||
.description("Test Description")
|
||||
.fields(Arrays.asList(
|
||||
new Field("Field1", "foo"),
|
||||
new Field("Field2", "bar"),
|
||||
new Field("Field3", "baz", true)
|
||||
));
|
||||
String expected = "{\"embed\":{\"title\":\"Test \\\"Title\\\"\",\"description\":\"Test Description\",\"color\":\"1381653\",\"author\":{\"name\":\"Etzelia\",\"url\":\"https://etzel.ia\"},\"fields\":[{\"name\":\"Field1\",\"value\":\"foo\"},{\"name\":\"Field2\",\"value\":\"bar\"},{\"name\":\"Field3\",\"value\":\"baz\",\"inline\":true}]}}";
|
||||
Assertions.assertEquals(expected, embed.toString());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue