mirror of
https://github.com/Kir-Antipov/mc-publish.git
synced 2024-11-25 09:51:01 -05:00
Covered ModMetadataReaderFactory with tests
This commit is contained in:
parent
81b2d3df85
commit
9effd57e82
1 changed files with 18 additions and 0 deletions
18
test/mod-metadata-reader-factory.test.ts
Normal file
18
test/mod-metadata-reader-factory.test.ts
Normal file
|
@ -0,0 +1,18 @@
|
|||
import { describe, test, expect } from "@jest/globals";
|
||||
import ModLoaderType from "../src/metadata/mod-loader-type";
|
||||
import ModMetadataReaderFactory from "../src/metadata/mod-metadata-reader-factory";
|
||||
|
||||
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();
|
||||
});
|
||||
});
|
Loading…
Reference in a new issue