style: fix linting issues met Prettier
This commit is contained in:
parent
4a6b6ee061
commit
437c2ba2fe
9 changed files with 170 additions and 170 deletions
|
@ -1,82 +1,82 @@
|
|||
import { describe, expect, it } from 'vitest';
|
||||
import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
assignmentTitleRules,
|
||||
classRules,
|
||||
deadlineRules,
|
||||
descriptionRules,
|
||||
learningPathRules,
|
||||
} from '../../src/utils/assignment-rules';
|
||||
} from "../../src/utils/assignment-rules";
|
||||
|
||||
describe('Validation Rules', () => {
|
||||
describe('assignmentTitleRules', () => {
|
||||
it('should return true for a valid title', () => {
|
||||
const result = assignmentTitleRules[0]('Valid Title');
|
||||
describe("Validation Rules", () => {
|
||||
describe("assignmentTitleRules", () => {
|
||||
it("should return true for a valid title", () => {
|
||||
const result = assignmentTitleRules[0]("Valid Title");
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return an error message for an empty title', () => {
|
||||
const result = assignmentTitleRules[0]('');
|
||||
expect(result).toBe('Title cannot be empty.');
|
||||
it("should return an error message for an empty title", () => {
|
||||
const result = assignmentTitleRules[0]("");
|
||||
expect(result).toBe("Title cannot be empty.");
|
||||
});
|
||||
});
|
||||
|
||||
describe('learningPathRules', () => {
|
||||
it('should return true for a valid learning path', () => {
|
||||
const result = learningPathRules[0]({ hruid: '123', title: 'Path Title' });
|
||||
describe("learningPathRules", () => {
|
||||
it("should return true for a valid learning path", () => {
|
||||
const result = learningPathRules[0]({ hruid: "123", title: "Path Title" });
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return an error message for an invalid learning path', () => {
|
||||
const result = learningPathRules[0]({ hruid: '', title: '' });
|
||||
expect(result).toBe('You must select a learning path.');
|
||||
it("should return an error message for an invalid learning path", () => {
|
||||
const result = learningPathRules[0]({ hruid: "", title: "" });
|
||||
expect(result).toBe("You must select a learning path.");
|
||||
});
|
||||
});
|
||||
|
||||
describe('classRules', () => {
|
||||
it('should return true for a valid class', () => {
|
||||
const result = classRules[0]('Class 1');
|
||||
describe("classRules", () => {
|
||||
it("should return true for a valid class", () => {
|
||||
const result = classRules[0]("Class 1");
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return an error message for an empty class', () => {
|
||||
const result = classRules[0]('');
|
||||
expect(result).toBe('You must select at least one class.');
|
||||
it("should return an error message for an empty class", () => {
|
||||
const result = classRules[0]("");
|
||||
expect(result).toBe("You must select at least one class.");
|
||||
});
|
||||
});
|
||||
|
||||
describe('deadlineRules', () => {
|
||||
it('should return true for a valid future deadline', () => {
|
||||
describe("deadlineRules", () => {
|
||||
it("should return true for a valid future deadline", () => {
|
||||
const futureDate = new Date(Date.now() + 1000 * 60 * 60).toISOString();
|
||||
const result = deadlineRules[0](futureDate);
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return an error message for a past deadline', () => {
|
||||
it("should return an error message for a past deadline", () => {
|
||||
const pastDate = new Date(Date.now() - 1000 * 60 * 60).toISOString();
|
||||
const result = deadlineRules[0](pastDate);
|
||||
expect(result).toBe('The deadline must be in the future.');
|
||||
expect(result).toBe("The deadline must be in the future.");
|
||||
});
|
||||
|
||||
it('should return an error message for an invalid date', () => {
|
||||
const result = deadlineRules[0]('invalid-date');
|
||||
expect(result).toBe('Invalid date or time.');
|
||||
it("should return an error message for an invalid date", () => {
|
||||
const result = deadlineRules[0]("invalid-date");
|
||||
expect(result).toBe("Invalid date or time.");
|
||||
});
|
||||
|
||||
it('should return an error message for an empty deadline', () => {
|
||||
const result = deadlineRules[0]('');
|
||||
expect(result).toBe('You must set a deadline.');
|
||||
it("should return an error message for an empty deadline", () => {
|
||||
const result = deadlineRules[0]("");
|
||||
expect(result).toBe("You must set a deadline.");
|
||||
});
|
||||
});
|
||||
|
||||
describe('descriptionRules', () => {
|
||||
it('should return true for a valid description', () => {
|
||||
const result = descriptionRules[0]('This is a valid description.');
|
||||
describe("descriptionRules", () => {
|
||||
it("should return true for a valid description", () => {
|
||||
const result = descriptionRules[0]("This is a valid description.");
|
||||
expect(result).toBe(true);
|
||||
});
|
||||
|
||||
it('should return an error message for an empty description', () => {
|
||||
const result = descriptionRules[0]('');
|
||||
expect(result).toBe('Description cannot be empty.');
|
||||
it("should return an error message for an empty description", () => {
|
||||
const result = descriptionRules[0]("");
|
||||
expect(result).toBe("Description cannot be empty.");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,68 +1,68 @@
|
|||
import { describe, it, expect } from 'vitest';
|
||||
import { deepEquals } from '../../src/utils/deep-equals';
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { deepEquals } from "../../src/utils/deep-equals";
|
||||
|
||||
describe('deepEquals', () => {
|
||||
it('should return true for identical primitive values', () => {
|
||||
expect(deepEquals(1, 1)).toBe(true);
|
||||
expect(deepEquals('test', 'test')).toBe(true);
|
||||
expect(deepEquals(true, true)).toBe(true);
|
||||
});
|
||||
describe("deepEquals", () => {
|
||||
it("should return true for identical primitive values", () => {
|
||||
expect(deepEquals(1, 1)).toBe(true);
|
||||
expect(deepEquals("test", "test")).toBe(true);
|
||||
expect(deepEquals(true, true)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for different primitive values', () => {
|
||||
expect(deepEquals(1, 2)).toBe(false);
|
||||
expect(deepEquals('test', 'other')).toBe(false);
|
||||
expect(deepEquals(true, false)).toBe(false);
|
||||
});
|
||||
it("should return false for different primitive values", () => {
|
||||
expect(deepEquals(1, 2)).toBe(false);
|
||||
expect(deepEquals("test", "other")).toBe(false);
|
||||
expect(deepEquals(true, false)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for identical objects', () => {
|
||||
const obj1 = { a: 1, b: { c: 2 } };
|
||||
const obj2 = { a: 1, b: { c: 2 } };
|
||||
expect(deepEquals(obj1, obj2)).toBe(true);
|
||||
});
|
||||
it("should return true for identical objects", () => {
|
||||
const obj1 = { a: 1, b: { c: 2 } };
|
||||
const obj2 = { a: 1, b: { c: 2 } };
|
||||
expect(deepEquals(obj1, obj2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for different objects', () => {
|
||||
const obj1 = { a: 1, b: { c: 2 } };
|
||||
const obj2 = { a: 1, b: { c: 3 } };
|
||||
expect(deepEquals(obj1, obj2)).toBe(false);
|
||||
});
|
||||
it("should return false for different objects", () => {
|
||||
const obj1 = { a: 1, b: { c: 2 } };
|
||||
const obj2 = { a: 1, b: { c: 3 } };
|
||||
expect(deepEquals(obj1, obj2)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for identical arrays', () => {
|
||||
const arr1 = [1, 2, [3, 4]];
|
||||
const arr2 = [1, 2, [3, 4]];
|
||||
expect(deepEquals(arr1, arr2)).toBe(true);
|
||||
});
|
||||
it("should return true for identical arrays", () => {
|
||||
const arr1 = [1, 2, [3, 4]];
|
||||
const arr2 = [1, 2, [3, 4]];
|
||||
expect(deepEquals(arr1, arr2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for different arrays', () => {
|
||||
const arr1 = [1, 2, [3, 4]];
|
||||
const arr2 = [1, 2, [3, 5]];
|
||||
expect(deepEquals(arr1, arr2)).toBe(false);
|
||||
});
|
||||
it("should return false for different arrays", () => {
|
||||
const arr1 = [1, 2, [3, 4]];
|
||||
const arr2 = [1, 2, [3, 5]];
|
||||
expect(deepEquals(arr1, arr2)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for objects and arrays compared', () => {
|
||||
expect(deepEquals({ a: 1 }, [1])).toBe(false);
|
||||
});
|
||||
it("should return false for objects and arrays compared", () => {
|
||||
expect(deepEquals({ a: 1 }, [1])).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for null compared to null', () => {
|
||||
expect(deepEquals(null, null)).toBe(true);
|
||||
});
|
||||
it("should return true for null compared to null", () => {
|
||||
expect(deepEquals(null, null)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for null compared to an object', () => {
|
||||
expect(deepEquals(null, {})).toBe(false);
|
||||
});
|
||||
it("should return false for null compared to an object", () => {
|
||||
expect(deepEquals(null, {})).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for undefined compared to null', () => {
|
||||
expect(deepEquals(undefined, null)).toBe(false);
|
||||
});
|
||||
it("should return false for undefined compared to null", () => {
|
||||
expect(deepEquals(undefined, null)).toBe(false);
|
||||
});
|
||||
|
||||
it('should return true for deeply nested identical structures', () => {
|
||||
const obj1 = { a: [1, { b: 2, c: [3, 4] }] };
|
||||
const obj2 = { a: [1, { b: 2, c: [3, 4] }] };
|
||||
expect(deepEquals(obj1, obj2)).toBe(true);
|
||||
});
|
||||
it("should return true for deeply nested identical structures", () => {
|
||||
const obj1 = { a: [1, { b: 2, c: [3, 4] }] };
|
||||
const obj2 = { a: [1, { b: 2, c: [3, 4] }] };
|
||||
expect(deepEquals(obj1, obj2)).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for deeply nested different structures', () => {
|
||||
const obj1 = { a: [1, { b: 2, c: [3, 4] }] };
|
||||
const obj2 = { a: [1, { b: 2, c: [3, 5] }] };
|
||||
expect(deepEquals(obj1, obj2)).toBe(false);
|
||||
});
|
||||
it("should return false for deeply nested different structures", () => {
|
||||
const obj1 = { a: [1, { b: 2, c: [3, 4] }] };
|
||||
const obj2 = { a: [1, { b: 2, c: [3, 5] }] };
|
||||
expect(deepEquals(obj1, obj2)).toBe(false);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue