2021-12-07 13:58:09 -05:00
|
|
|
import { describe, test, expect } from "@jest/globals";
|
2022-07-05 13:44:29 -04:00
|
|
|
import ModLoaderType from "../../../src/metadata/mod-loader-type";
|
|
|
|
import ModMetadataReaderFactory from "../../../src/metadata/mod-metadata-reader-factory";
|
2021-12-07 13:58:09 -05:00
|
|
|
|
|
|
|
describe("ModMetadataReaderFactory.create", () => {
|
|
|
|
test("factory can create metadata reader for every ModLoaderType value", () => {
|
|
|
|
const factory = new ModMetadataReaderFactory();
|
|
|
|
for (const target of ModLoaderType.getValues()) {
|
|
|
|
const reader = factory.create(target);
|
|
|
|
expect(reader).toHaveProperty("readMetadata");
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
test("the method throws on invalid ModLoaderType value", () => {
|
|
|
|
const factory = new ModMetadataReaderFactory();
|
|
|
|
expect(() => factory.create(-1)).toThrow();
|
|
|
|
});
|
|
|
|
});
|