-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTransformer.test.ts
More file actions
41 lines (36 loc) · 1.21 KB
/
Transformer.test.ts
File metadata and controls
41 lines (36 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import {
Challenge,
Evaluation,
Format,
} from "../../../app/challenges-platform/models";
import { BaseTransformer } from "../../../app/challenges-platform/models/Transformer";
describe("BaseTransformer", () => {
describe("newChallenge", () => {
it("should create a new Challenge instance with the provided data", () => {
const payload = {
id: 1,
uuid: "abc123",
title: "Test Challenge",
body: "This is a test challenge",
points: 10,
};
const challenge = BaseTransformer.newChallenge(payload);
expect(challenge).toBeInstanceOf(Challenge);
expect(challenge.id).toBe(payload.id);
expect(challenge.uuid).toBe(payload.uuid);
expect(challenge.title).toBe(payload.title);
expect(challenge.body).toBe(payload.body);
expect(challenge.format).toBe(Format.TEXT);
expect(challenge.points).toBe(payload.points);
expect(challenge.evaluation).toBe(Evaluation.MANUAL);
});
});
describe("validateChallengeMetadata", () => {
it("should return true", async () => {
const isMetadataValid = await BaseTransformer.validateChallengeMetadata(
{},
);
expect(isMetadataValid).toBe(true);
});
});
});