Skip to content

Commit

Permalink
Update tests for matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
WalshyDev committed Jul 4, 2023
1 parent d8dee9d commit dae0746
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Upload
if: ${{ github.repository_owner == 'Slimefun' && github.ref == 'refS/heads/main' }}
run: |
curl -v -X POST \
curl -X POST \
-H 'Authorization: ${{ secrets.PUBLISH_TOKEN }}' \
-H "X-Checksum: $(sha256sum target/e2e-test-plugin.jar | awk '{print $1}')" \
--data-binary '@target/e2e-test-plugin.jar' \
Expand Down
17 changes: 15 additions & 2 deletions src/main/java/io/github/slimefun/e2etester/tests/VersionsTest.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package io.github.slimefun.e2etester.tests;

import org.bukkit.Bukkit;

import io.github.slimefun.e2etester.framework.Assert;
import io.github.slimefun.e2etester.framework.annotations.E2ETest;

public class VersionsTest {

@E2ETest(description = "Test that `/sf versions` returns the right MC version")
public void testMcVersion() {
Assert.runConsoleCommand("sf versions", (output) -> output.contains("MC: 1.20.1"));
Assert.runConsoleCommand("sf versions", (output) -> output.contains("Paper " + Bukkit.getVersion()));
}

@E2ETest(description = "Test that `/sf versions` returns the right SF version")
Expand All @@ -17,6 +19,17 @@ public void testSlimefunVersion() {

@E2ETest(description = "Test that `/sf versions` returns the right Java version")
public void testJavaVersion() {
Assert.runConsoleCommand("sf versions", (output) -> output.contains("Java 20"));
// Grab the Java version, if it's still a 1.x strip that and then remove minor so we go from 1.8.1 -> 8
String expectedVersion = System.getProperty("java.version");
if (expectedVersion.startsWith("1.")) {
expectedVersion = expectedVersion.substring(2);
}
int minorVersionIdx = expectedVersion.indexOf('.');
if (minorVersionIdx != -1) {
expectedVersion = expectedVersion.substring(0, minorVersionIdx);
}

final String finalExpectedVersion = expectedVersion;
Assert.runConsoleCommand("sf versions", (output) -> output.contains("Java " + finalExpectedVersion));
}
}

0 comments on commit dae0746

Please sign in to comment.