Skip to content

Commit

Permalink
refactor(collections): format test names (#3988)
Browse files Browse the repository at this point in the history
  • Loading branch information
timreichen authored Dec 20, 2023
1 parent bf7bb68 commit fc1f3e4
Show file tree
Hide file tree
Showing 43 changed files with 326 additions and 330 deletions.
8 changes: 4 additions & 4 deletions collections/aggregate_groups_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function aggregateGroupsTest<T, A>(
}

Deno.test({
name: "[collections/aggregateGroups] no mutation",
name: "aggregateGroups() handles no mutation",
fn() {
const input = {
Woody: [2, 3, 1, 4],
Expand All @@ -33,7 +33,7 @@ Deno.test({
});

Deno.test({
name: "[collections/aggregateGroups] string building using all params",
name: "aggregateGroups() handles string building using all params",
fn() {
aggregateGroupsTest(
[
Expand All @@ -58,7 +58,7 @@ Deno.test({
});

Deno.test({
name: "[collections/aggregateGroups] sum ignoring non reduce params",
name: "aggregateGroups() handles sum ignoring non reduce params",
fn() {
aggregateGroupsTest(
[
Expand All @@ -77,7 +77,7 @@ Deno.test({
});

Deno.test({
name: "[collections/aggregateGroups] empty input",
name: "aggregateGroups() handles empty input",
fn() {
aggregateGroupsTest([
{},
Expand Down
12 changes: 6 additions & 6 deletions collections/associate_by_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function associateByTest<T>(
}

Deno.test({
name: "[collections/associateBy] no mutation",
name: "associateBy() handles no mutation",
fn() {
const arrayA = ["Foo", "Bar"];
associateBy(arrayA, (it) => it.charAt(0));
Expand All @@ -23,7 +23,7 @@ Deno.test({
});

Deno.test({
name: "[collections/associateBy] empty input",
name: "associateBy() handles empty input",
fn() {
associateByTest(
[[], () => "a"],
Expand All @@ -33,7 +33,7 @@ Deno.test({
});

Deno.test({
name: "[collections/associateBy] constant key",
name: "associateBy() handles constant key",
fn() {
associateByTest(
[[1, 3, 5, 6], () => "a"],
Expand All @@ -43,7 +43,7 @@ Deno.test({
});

Deno.test({
name: "[collections/associateBy] empty key",
name: "associateBy() handles empty key",
fn() {
associateByTest(
[
Expand All @@ -59,7 +59,7 @@ Deno.test({
});

Deno.test({
name: "[collections/associateBy] duplicate keys",
name: "associateBy() handles duplicate keys",
fn() {
associateByTest(
[
Expand Down Expand Up @@ -87,7 +87,7 @@ Deno.test({
});

Deno.test({
name: "[collections/associateBy] associates",
name: "associateBy() handles associates",
fn() {
associateByTest(
[
Expand Down
8 changes: 4 additions & 4 deletions collections/associate_with_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function associateWithTest<T>(
}

Deno.test({
name: "[collections/associateWith] no mutation",
name: "associateWith() handles no mutation",
fn() {
const arrayA = ["Foo", "Bar"];
associateWith(arrayA, (it) => it.charAt(0));
Expand All @@ -23,14 +23,14 @@ Deno.test({
});

Deno.test({
name: "[collections/associateWith] empty input",
name: "associateWith() handles empty input",
fn() {
associateWithTest([[], () => "abc"], {});
},
});

Deno.test({
name: "[collections/associateWith] associates",
name: "associateWith() handles associates",
fn() {
associateWithTest<number>(
[
Expand Down Expand Up @@ -81,7 +81,7 @@ Deno.test({
});

Deno.test({
name: "[collections/associateWith] duplicate keys",
name: "associateWith() handles duplicate keys",
fn() {
associateWithTest(
[
Expand Down
14 changes: 7 additions & 7 deletions collections/chunk_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function chunkTest<I>(
const testArray = [1, 2, 3, 4, 5, 6];

Deno.test({
name: "[collections/chunk] no mutation",
name: "chunk() handles no mutation",
fn() {
const array = [1, 2, 3, 4];
chunk(array, 2);
Expand All @@ -25,7 +25,7 @@ Deno.test({
});

Deno.test({
name: "[collections/chunk] throws on non naturals",
name: "chunk() throws on non naturals",
fn() {
assertThrows(() => chunk([], +.5));
assertThrows(() => chunk([], -4.7));
Expand All @@ -36,7 +36,7 @@ Deno.test({
});

Deno.test({
name: "[collections/chunk] empty input",
name: "chunk() handles empty input",
fn() {
chunkTest(
[[], 1],
Expand All @@ -46,7 +46,7 @@ Deno.test({
});

Deno.test({
name: "[collections/chunk] single element chunks",
name: "chunk() handles single element chunks",
fn() {
chunkTest(
[testArray, 1],
Expand All @@ -60,7 +60,7 @@ Deno.test({
});

Deno.test({
name: "[collections/chunk] n chunks fitting",
name: "chunk() handles n chunks fitting",
fn() {
chunkTest(
[testArray, 2],
Expand All @@ -74,7 +74,7 @@ Deno.test({
});

Deno.test({
name: "[collections/chunk] n chunks not fitting",
name: "chunk() handles n chunks not fitting",
fn() {
chunkTest(
[testArray, 4],
Expand All @@ -88,7 +88,7 @@ Deno.test({
});

Deno.test({
name: "[collections/chunk] chunks equal to length",
name: "chunk() handles chunks equal to length",
fn() {
chunkTest(
[testArray, testArray.length],
Expand Down
42 changes: 21 additions & 21 deletions collections/deep_merge_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { assertEquals, assertStrictEquals } from "../assert/mod.ts";
import { deepMerge } from "./deep_merge.ts";

Deno.test("deepMerge: simple merge", () => {
Deno.test("deepMerge() handles simple merge", () => {
assertEquals(
deepMerge({
foo: true,
Expand All @@ -16,7 +16,7 @@ Deno.test("deepMerge: simple merge", () => {
);
});

Deno.test("deepMerge: symbol merge", () => {
Deno.test("deepMerge() handles symbol merge", () => {
assertEquals(
deepMerge({}, {
[Symbol.for("deepmerge.test")]: true,
Expand All @@ -27,7 +27,7 @@ Deno.test("deepMerge: symbol merge", () => {
);
});

Deno.test("deepMerge: ignore non enumerable", () => {
Deno.test("deepMerge() ignores non enumerable", () => {
assertEquals(
deepMerge(
{},
Expand All @@ -42,7 +42,7 @@ Deno.test("deepMerge: ignore non enumerable", () => {
);
});

Deno.test("deepMerge: nested merge", () => {
Deno.test("deepMerge() handles nested merge", () => {
assertEquals(
deepMerge({
foo: {
Expand All @@ -66,7 +66,7 @@ Deno.test("deepMerge: nested merge", () => {
);
});

Deno.test("deepMerge: prevent prototype merge", () => {
Deno.test("deepMerge() prevents prototype merge", () => {
assertEquals(
deepMerge({
constructor: undefined,
Expand All @@ -80,7 +80,7 @@ Deno.test("deepMerge: prevent prototype merge", () => {
);
});

Deno.test("deepMerge: prevent calling Object.prototype.__proto__ accessor property", () => {
Deno.test("deepMerge() prevents calling Object.prototype.__proto__ accessor property", () => {
Object.defineProperty(Object.prototype, "__proto__", {
get() {
throw new Error(
Expand Down Expand Up @@ -113,7 +113,7 @@ Deno.test("deepMerge: prevent calling Object.prototype.__proto__ accessor proper
}
});

Deno.test("deepMerge: override target (non-mergeable source)", () => {
Deno.test("deepMerge() overrides target (non-mergeable source)", () => {
assertEquals(
deepMerge({
foo: {
Expand All @@ -128,7 +128,7 @@ Deno.test("deepMerge: override target (non-mergeable source)", () => {
);
});

Deno.test("deepMerge: override target (non-mergeable destination, object like)", () => {
Deno.test("deepMerge() overrides target (non-mergeable destination, object like)", () => {
const CustomClass = class {};
assertEquals(
deepMerge({
Expand All @@ -142,7 +142,7 @@ Deno.test("deepMerge: override target (non-mergeable destination, object like)",
);
});

Deno.test("deepMerge: override target (non-mergeable destination, array like)", () => {
Deno.test("deepMerge() overrides target (non-mergeable destination, array like)", () => {
assertEquals(
deepMerge({
foo: [],
Expand All @@ -155,7 +155,7 @@ Deno.test("deepMerge: override target (non-mergeable destination, array like)",
);
});

Deno.test("deepMerge: override target (different object like source and destination)", () => {
Deno.test("deepMerge() overrides target (different object like source and destination)", () => {
assertEquals(
deepMerge({
foo: {},
Expand All @@ -178,7 +178,7 @@ Deno.test("deepMerge: override target (different object like source and destinat
);
});

Deno.test("deepMerge: primitive types handling", () => {
Deno.test("deepMerge() handles primitive types handling", () => {
const CustomClass = class {};
const expected = {
boolean: true,
Expand Down Expand Up @@ -221,7 +221,7 @@ Deno.test("deepMerge: primitive types handling", () => {
);
});

Deno.test("deepMerge: array merge (replace)", () => {
Deno.test("deepMerge() handles array merge (replace)", () => {
assertEquals(
deepMerge({
foo: [1, 2, 3],
Expand All @@ -234,7 +234,7 @@ Deno.test("deepMerge: array merge (replace)", () => {
);
});

Deno.test("deepMerge: array merge (merge)", () => {
Deno.test("deepMerge() handles array merge (merge)", () => {
assertEquals(
deepMerge({
foo: [1, 2, 3],
Expand All @@ -247,7 +247,7 @@ Deno.test("deepMerge: array merge (merge)", () => {
);
});

Deno.test("deepMerge: maps merge (replace)", () => {
Deno.test("deepMerge() handles maps merge (replace)", () => {
assertEquals(
deepMerge({
map: new Map([["foo", true]]),
Expand All @@ -260,7 +260,7 @@ Deno.test("deepMerge: maps merge (replace)", () => {
);
});

Deno.test("deepMerge: maps merge (merge)", () => {
Deno.test("deepMerge() handles maps merge (merge)", () => {
assertEquals(
deepMerge({
map: new Map([["foo", true]]),
Expand All @@ -273,7 +273,7 @@ Deno.test("deepMerge: maps merge (merge)", () => {
);
});

Deno.test("deepMerge: sets merge (replace)", () => {
Deno.test("deepMerge() handles sets merge (replace)", () => {
assertEquals(
deepMerge({
set: new Set(["foo"]),
Expand All @@ -286,7 +286,7 @@ Deno.test("deepMerge: sets merge (replace)", () => {
);
});

Deno.test("deepMerge: sets merge (merge)", () => {
Deno.test("deepMerge() handles sets merge (merge)", () => {
assertEquals(
deepMerge({
set: new Set(["foo"]),
Expand All @@ -299,7 +299,7 @@ Deno.test("deepMerge: sets merge (merge)", () => {
);
});

Deno.test("deepMerge: nested replace", () => {
Deno.test("deepMerge() handles nested replace", () => {
assertEquals(
deepMerge(
{
Expand Down Expand Up @@ -332,7 +332,7 @@ Deno.test("deepMerge: nested replace", () => {
);
});

Deno.test("deepMerge: complex test", () => {
Deno.test("deepMerge() handles complex test", () => {
assertEquals(
deepMerge({
foo: {
Expand Down Expand Up @@ -371,7 +371,7 @@ Deno.test("deepMerge: complex test", () => {
);
});

Deno.test("deepMerge: handle circular references", () => {
Deno.test("deepMerge() handles circular references", () => {
const expected = { foo: true } as { foo: boolean; bar: unknown };
expected.bar = expected;
assertEquals(deepMerge({}, expected), expected);
Expand All @@ -395,7 +395,7 @@ Deno.test("deepMerge: handle circular references", () => {
assertStrictEquals(result.foo.b.c.d, result.foo.b.c.d.foo.b.c.d);
});

Deno.test("deepMerge: target object is not modified", () => {
Deno.test("deepMerge() handles target object is not modified", () => {
const record = {
foo: {
bar: true,
Expand Down
Loading

0 comments on commit fc1f3e4

Please sign in to comment.