mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-21 16:00:59 -05:00
Added NeoForgeEnvironmentType
This commit is contained in:
parent
883bd31e30
commit
db98decdd8
2 changed files with 73 additions and 0 deletions
44
src/loaders/neoforge/neoforge-environment-type.ts
Normal file
44
src/loaders/neoforge/neoforge-environment-type.ts
Normal file
|
@ -0,0 +1,44 @@
|
|||
import { Enum, EnumOptions } from "@/utils/enum";
|
||||
|
||||
/**
|
||||
* Represents the different physical sides that a NeoForge mod can run on.
|
||||
*/
|
||||
enum NeoForgeEnvironmentTypeValues {
|
||||
/**
|
||||
* Present on the client side.
|
||||
*/
|
||||
CLIENT = "CLIENT",
|
||||
|
||||
/**
|
||||
* Present on the dedicated server.
|
||||
*/
|
||||
SERVER = "SERVER",
|
||||
|
||||
/**
|
||||
* Present on both the client and server side.
|
||||
*/
|
||||
BOTH = "BOTH",
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for configuring the behavior of the `NeoForgeEnvironmentType` enum.
|
||||
*/
|
||||
const NeoForgeEnvironmentTypeOptions: EnumOptions = {
|
||||
/**
|
||||
* Ignore the case of the environment type string when parsing.
|
||||
*/
|
||||
ignoreCase: true,
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the different physical sides that a NeoForge mod can run on.
|
||||
*/
|
||||
export const NeoForgeEnvironmentType = Enum.create(
|
||||
NeoForgeEnvironmentTypeValues,
|
||||
NeoForgeEnvironmentTypeOptions,
|
||||
);
|
||||
|
||||
/**
|
||||
* Represents the different physical sides that a NeoForge mod can run on.
|
||||
*/
|
||||
export type NeoForgeEnvironmentType = Enum<typeof NeoForgeEnvironmentTypeValues>;
|
|
@ -0,0 +1,29 @@
|
|||
import { NeoForgeEnvironmentType } from "@/loaders/neoforge/neoforge-environment-type";
|
||||
|
||||
describe("NeoForgeEnvironmentType", () => {
|
||||
describe("parse", () => {
|
||||
test("parses all its own formatted values", () => {
|
||||
for (const value of NeoForgeEnvironmentType.values()) {
|
||||
expect(NeoForgeEnvironmentType.parse(NeoForgeEnvironmentType.format(value))).toBe(value);
|
||||
}
|
||||
});
|
||||
|
||||
test("parses all friendly names of its own values", () => {
|
||||
for (const value of NeoForgeEnvironmentType.values()) {
|
||||
expect(NeoForgeEnvironmentType.parse(NeoForgeEnvironmentType.friendlyNameOf(value))).toBe(value);
|
||||
}
|
||||
});
|
||||
|
||||
test("parses all its own formatted values in lowercase", () => {
|
||||
for (const value of NeoForgeEnvironmentType.values()) {
|
||||
expect(NeoForgeEnvironmentType.parse(NeoForgeEnvironmentType.format(value).toLowerCase())).toBe(value);
|
||||
}
|
||||
});
|
||||
|
||||
test("parses all its own formatted values in UPPERCASE", () => {
|
||||
for (const value of NeoForgeEnvironmentType.values()) {
|
||||
expect(NeoForgeEnvironmentType.parse(NeoForgeEnvironmentType.format(value).toUpperCase())).toBe(value);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue