generated from filipe1309/shubcogen-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsolution.spec.ts
More file actions
23 lines (22 loc) · 728 Bytes
/
solution.spec.ts
File metadata and controls
23 lines (22 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { describe, expect, test } from '@jest/globals';
import cases from './cases';
import {
solution0, // O(n*logn) time | O(n) space
solution1, // O(n*logn) time | O(n) space
} from "./solutions";
// Test: make test t=task-assignment
describe('task-assignment', () => {
test.each(cases)('%# (%j)', ({ input, expected }) => {
let result = solution1(input.k, input.tasks);
console.log({ result, expected });
// sort expected
expected.map((answer) => answer.sort());
expected.sort();
// sort result
result.map((pair) => pair.sort());
result.sort();
// There are multiple possible answers
// adjust cases.ts to reflect this if needed
expect(result).toEqual(expected);
});
});