From 02315817ec1f9835c4ada229f731c5672a212bfb Mon Sep 17 00:00:00 2001 From: Katy DeCorah Date: Tue, 19 Dec 2023 18:25:02 -0500 Subject: [PATCH] Fix casing --- dist/index.js | 8 ++--- src/__tests__/clean-book.test.ts | 26 +++++++------- src/__tests__/index.test.ts | 10 +++--- src/__tests__/utils.test.ts | 60 ++++++++++++++++---------------- src/__tests__/workflow.test.ts | 13 ++++--- src/index.ts | 8 ++--- src/utils.ts | 16 ++++----- 7 files changed, 72 insertions(+), 69 deletions(-) diff --git a/dist/index.js b/dist/index.js index 74e8916e..8b3bd42e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -35206,20 +35206,20 @@ function getBookStatus({ date, bookStatus, }) { switch (bookStatus) { case "abandoned": return { - "date-abandoned": dateValue, + dateAbandoned: dateValue, }; case "started": return { - "date-started": dateValue, + dateStarted: dateValue, }; case "finished": return { - "date-finished": dateValue, + dateFinished: dateValue, }; case "want to read": default: { return { - "date-added": dateValue, + dateAdded: dateValue, }; } } diff --git a/src/__tests__/clean-book.test.ts b/src/__tests__/clean-book.test.ts index 29b2088b..10d4069f 100644 --- a/src/__tests__/clean-book.test.ts +++ b/src/__tests__/clean-book.test.ts @@ -24,7 +24,7 @@ describe("cleanBook", () => { expect( cleanBook( { - dateType: { "date-finished": dateFinished }, + dateType: { dateFinished: dateFinished }, notes: "I loved it!", bookIsbn: "0525658181", providers: [], @@ -41,7 +41,7 @@ describe("cleanBook", () => { "categories": [ "Fiction", ], - "date-finished": "2020-09-12", + "dateFinished": "2020-09-12", "description": "A novel about faith, science, religion, and family that tells the deeply moving portrait of a family of Ghanaian immigrants ravaged by depression and addiction and grief, narrated by a fifth year candidate in neuroscience at Stanford school of medicine studying the neural circuits of reward seeking behavior in mice…", "isbn": "0525658181", "language": "en", @@ -60,7 +60,7 @@ describe("cleanBook", () => { expect( cleanBook( { - dateType: { "date-finished": dateFinished }, + dateType: { dateFinished: dateFinished }, notes: "I loved it!", bookIsbn: "0525658181", providers: [], @@ -78,7 +78,7 @@ describe("cleanBook", () => { "categories": [ "Fiction", ], - "date-finished": "2020-09-12", + "dateFinished": "2020-09-12", "description": "A novel about faith, science, religion, and family that tells the deeply moving portrait of a family of Ghanaian immigrants ravaged by depression and addiction and grief, narrated by a fifth year candidate in neuroscience at Stanford school of medicine studying the neural circuits of reward seeking behavior in mice…", "isbn": "0525658181", "language": "en", @@ -133,7 +133,7 @@ describe("cleanBook", () => { const warningSpy = jest.spyOn(core, "warning"); cleanBook( { - dateType: { "date-started": "2022-01-01" }, + dateType: { dateStarted: "2022-01-01" }, bookIsbn: "1234597890", providers: [], bookStatus: "started", @@ -181,7 +181,7 @@ describe("cleanBook", () => { const exportVariableSpy = jest.spyOn(core, "exportVariable"); cleanBook( { - dateType: { "date-started": "2022-01-01" }, + dateType: { dateStarted: "2022-01-01" }, bookIsbn: "1234597890", providers: [], bookStatus: "started", @@ -230,7 +230,7 @@ describe("cleanBook", () => { const exportVariableSpy = jest.spyOn(core, "exportVariable"); cleanBook( { - dateType: { "date-started": "2022-01-01" }, + dateType: { dateStarted: "2022-01-01" }, bookIsbn: "1234597890", providers: [], bookStatus: "started", @@ -279,7 +279,7 @@ describe("cleanBook", () => { const exportVariableSpy = jest.spyOn(core, "exportVariable"); cleanBook( { - dateType: { "date-started": "2022-01-01" }, + dateType: { dateStarted: "2022-01-01" }, bookIsbn: "1234597890", providers: [], bookStatus: "started", @@ -331,7 +331,7 @@ describe("cleanBook", () => { ); cleanBook( { - dateType: { "date-started": "2022-01-01" }, + dateType: { dateStarted: "2022-01-01" }, bookIsbn: "1234597890", providers: [], bookStatus: "started", @@ -358,7 +358,7 @@ describe("cleanBook", () => { expect( cleanBook( { - dateType: { "date-finished": dateFinished }, + dateType: { dateFinished: dateFinished }, notes: "I loved it!", bookIsbn: "0525658181", providers: [], @@ -376,7 +376,7 @@ describe("cleanBook", () => { "categories": [ "Fiction", ], - "date-finished": "2020-09-12", + "dateFinished": "2020-09-12", "description": "A novel about faith, science, religion, and family that tells the deeply moving portrait of a family of Ghanaian immigrants ravaged by depression and addiction and grief, narrated by a fifth year candidate in neuroscience at Stanford school of medicine studying the neural circuits of reward seeking behavior in mice…", "isbn": "0525658181", "language": "en", @@ -398,7 +398,7 @@ describe("cleanBook", () => { expect( cleanBook( { - dateType: { "date-finished": dateFinished }, + dateType: { dateFinished: dateFinished }, notes: "I loved it!", bookIsbn: "0525658181", providers: [], @@ -416,7 +416,7 @@ describe("cleanBook", () => { "categories": [ "Fiction", ], - "date-finished": "2020-09-12", + "dateFinished": "2020-09-12", "description": "A novel about faith, science, religion, and family that tells the deeply moving portrait of a family of Ghanaian immigrants ravaged by depression and addiction and grief, narrated by a fifth year candidate in neuroscience at Stanford school of medicine studying the neural circuits of reward seeking behavior in mice…", "isbn": "0525658181", "language": "en", diff --git a/src/__tests__/index.test.ts b/src/__tests__/index.test.ts index ab01fdb7..625a140f 100644 --- a/src/__tests__/index.test.ts +++ b/src/__tests__/index.test.ts @@ -148,7 +148,7 @@ describe("index", () => { "categories": [ "Fiction", ], - "date-started": "2022-01-02", + "dateStarted": "2022-01-02", "description": "NEW YORK TIMES BESTSELLER Winner of the 2020 Center for Fiction First Novel Prize Winner of the 2020 National Book Critics Circle's John Leonard Prize for Best First Book Winner of the 2020 Kirkus Prize for Fiction Winner of the 2021 Dylan Thomas Prize Finalist for the 2021 PEN/Hemingway Award for Best First Novel Longlisted for the 2021 Andrew Carnegie Medal for Excellence in Fiction Longlisted for the 2021 PEN/Jean Stein Book Award Longlisted for the 2021 Women's Prize for Fiction A New York Times Notable Book of the Year Named Best Book of the Year by O: the Oprah Magazine, Vanity Fair, Los Angeles Times, Town and Country, Amazon, Indigo, NPR, Harper’s Bazaar, Kirkus Reviews, Marie Claire, Good Housekeeping Sharp, comic, disruptive, and tender, Luster sees a young Black woman fall into art and someone else's open marriage. Edie is stumbling her way through her twenties—sharing a subpar apartment in Bushwick, clocking in and out of her admin job, making a series of inappropriate sexual choices. She's also, secretly, haltingly, figuring her way into life as an artist. And then she meets Eric, a digital archivist with a family in New Jersey, including an autopsist wife who has agreed to an open marriage—with rules. As if navigating the constantly shifting landscapes of contemporary sexual manners and racial politics weren't hard enough, Edie finds herself unemployed and falling into Eric's family life, his home. She becomes a hesitant friend to his wife and a de facto role model to his adopted daughter. Edie is the only Black woman who young Akila knows. Razor-sharp, darkly comic, sexually charged, socially disruptive, Luster is a portrait of a young woman trying to make sense of her life in a tumultuous era. It is also a haunting, aching description of how hard it is to believe in your own talent and the unexpected influences that bring us into ourselves along the way.", "isbn": "9780385696005", "language": "en", @@ -202,7 +202,7 @@ describe("index", () => { "categories": [ "Fiction", ], - "date-finished": "2021-09-30", + "dateFinished": "2021-09-30", "dateStarted": "2021-09-26", "description": "NEW YORK TIMES BESTSELLER", "isbn": "9780525620792", @@ -285,7 +285,7 @@ describe("index", () => { "categories": [ "Fiction", ], - "date-finished": "2022-08-02", + "dateFinished": "2022-08-02", "description": "NATIONAL BESTSELLER • A “dazzling, cinematic, intimate, lyrical” (Roxane Gay) epic of betrayal, love, and fate that spans five generations of an Indigenous Chicano family in the American West, from the author of the National Book Award finalist Sabrina & Corina “Sometimes you just step into a book and let it wash over you, like you’re swimming under a big, sparkling night sky.”—Celeste Ng, author of Little Fires Everywhere and Everything I Never Told You A PHENOMENAL BOOK CLUB PICK AND AN AUDACIOUS BOOK CLUB PICK • ONE OF THE BEST BOOKS OF THE YEAR: Book Riot There is one every generation, a seer who keeps the stories. Luz “Little Light” Lopez, a tea leaf reader and laundress, is left to fend for herself after her older brother, Diego, a snake charmer and factory worker, is run out of town by a violent white mob. As Luz navigates 1930s Denver, she begins to have visions that transport her to her Indigenous homeland in the nearby Lost Territory. Luz recollects her ancestors’ origins, how her family flourished, and how they were threatened. She bears witness to the sinister forces that have devastated her people and their homelands for generations. In the end, it is up to Luz to save her family stories from disappearing into oblivion. Written in Kali Fajardo-Anstine’s singular voice, the wildly entertaining and complex lives of the Lopez family fill the pages of this multigenerational western saga. Woman of Light is a transfixing novel about survival, family secrets, and love—filled with an unforgettable cast of characters, all of whom are just as special, memorable, and complicated as our beloved heroine, Luz. LONGLISTED FOR THE JOYCE CAROL OATES PRIZE • LONGLISTED FOR THE CAROL SHIELDS PRIZE FOR FICTION", "isbn": "9780525511342", "language": "en", @@ -379,7 +379,7 @@ describe("index", () => { "categories": [ "Fiction", ], - "date-added": "2022-10-01", + "dateAdded": "2022-10-01", "description": "NEW YORK TIMES BESTSELLER Winner of the 2020 Center for Fiction First Novel Prize Winner of the 2020 National Book Critics Circle's John Leonard Prize for Best First Book Winner of the 2020 Kirkus Prize for Fiction Winner of the 2021 Dylan Thomas Prize Finalist for the 2021 PEN/Hemingway Award for Best First Novel Longlisted for the 2021 Andrew Carnegie Medal for Excellence in Fiction Longlisted for the 2021 PEN/Jean Stein Book Award Longlisted for the 2021 Women's Prize for Fiction A New York Times Notable Book of the Year Named Best Book of the Year by O: the Oprah Magazine, Vanity Fair, Los Angeles Times, Town and Country, Amazon, Indigo, NPR, Harper’s Bazaar, Kirkus Reviews, Marie Claire, Good Housekeeping Sharp, comic, disruptive, and tender, Luster sees a young Black woman fall into art and someone else's open marriage. Edie is stumbling her way through her twenties—sharing a subpar apartment in Bushwick, clocking in and out of her admin job, making a series of inappropriate sexual choices. She's also, secretly, haltingly, figuring her way into life as an artist. And then she meets Eric, a digital archivist with a family in New Jersey, including an autopsist wife who has agreed to an open marriage—with rules. As if navigating the constantly shifting landscapes of contemporary sexual manners and racial politics weren't hard enough, Edie finds herself unemployed and falling into Eric's family life, his home. She becomes a hesitant friend to his wife and a de facto role model to his adopted daughter. Edie is the only Black woman who young Akila knows. Razor-sharp, darkly comic, sexually charged, socially disruptive, Luster is a portrait of a young woman trying to make sense of her life in a tumultuous era. It is also a haunting, aching description of how hard it is to believe in your own talent and the unexpected influences that bring us into ourselves along the way.", "isbn": "9780385696005", "language": "en", @@ -485,7 +485,7 @@ describe("index", () => { "categories": [ "Fiction", ], - "date-added": "2022-10-01", + "dateAdded": "2022-10-01", "description": "NEW YORK TIMES BESTSELLER Winner of the 2020 Center for Fiction First Novel Prize Winner of the 2020 National Book Critics Circle's John Leonard Prize for Best First Book Winner of the 2020 Kirkus Prize for Fiction Winner of the 2021 Dylan Thomas Prize Finalist for the 2021 PEN/Hemingway Award for Best First Novel Longlisted for the 2021 Andrew Carnegie Medal for Excellence in Fiction Longlisted for the 2021 PEN/Jean Stein Book Award Longlisted for the 2021 Women's Prize for Fiction A New York Times Notable Book of the Year Named Best Book of the Year by O: the Oprah Magazine, Vanity Fair, Los Angeles Times, Town and Country, Amazon, Indigo, NPR, Harper’s Bazaar, Kirkus Reviews, Marie Claire, Good Housekeeping Sharp, comic, disruptive, and tender, Luster sees a young Black woman fall into art and someone else's open marriage. Edie is stumbling her way through her twenties—sharing a subpar apartment in Bushwick, clocking in and out of her admin job, making a series of inappropriate sexual choices. She's also, secretly, haltingly, figuring her way into life as an artist. And then she meets Eric, a digital archivist with a family in New Jersey, including an autopsist wife who has agreed to an open marriage—with rules. As if navigating the constantly shifting landscapes of contemporary sexual manners and racial politics weren't hard enough, Edie finds herself unemployed and falling into Eric's family life, his home. She becomes a hesitant friend to his wife and a de facto role model to his adopted daughter. Edie is the only Black woman who young Akila knows. Razor-sharp, darkly comic, sexually charged, socially disruptive, Luster is a portrait of a young woman trying to make sense of her life in a tumultuous era. It is also a haunting, aching description of how hard it is to believe in your own talent and the unexpected influences that bring us into ourselves along the way.", "isbn": "9780385696005", "language": "en", diff --git a/src/__tests__/utils.test.ts b/src/__tests__/utils.test.ts index 92f92dc0..a8e61df3 100644 --- a/src/__tests__/utils.test.ts +++ b/src/__tests__/utils.test.ts @@ -48,57 +48,57 @@ it("sortByDate", () => { it("getBookStatus", () => { expect( - getBookStatus({ - date: "2020-01-01", - bookStatus: "abandoned", - }) - ).toMatchInlineSnapshot(` + getBookStatus({ + date: "2020-01-01", + bookStatus: "abandoned" + }) +).toMatchInlineSnapshot(` { - "date-abandoned": "2020-01-01", + "dateAbandoned": "2020-01-01", } `); expect( - getBookStatus({ - date: "2020-01-01", - bookStatus: "finished", - }) - ).toMatchInlineSnapshot(` + getBookStatus({ + date: "2020-01-01", + bookStatus: "finished" + }) +).toMatchInlineSnapshot(` { - "date-finished": "2020-01-01", + "dateFinished": "2020-01-01", } `); expect( - getBookStatus({ - date: "2020-01-01", - bookStatus: "started", - }) - ).toMatchInlineSnapshot(` + getBookStatus({ + date: "2020-01-01", + bookStatus: "started" + }) +).toMatchInlineSnapshot(` { - "date-started": "2020-01-01", + "dateStarted": "2020-01-01", } `); expect( - getBookStatus({ - date: "2020-01-01", - bookStatus: "want to read", - }) - ).toMatchInlineSnapshot(` + getBookStatus({ + date: "2020-01-01", + bookStatus: "want to read" + }) +).toMatchInlineSnapshot(` { - "date-added": "2020-01-01", + "dateAdded": "2020-01-01", } `); expect( - getBookStatus({ - date: "2020-01-01", - }) - ).toMatchInlineSnapshot(` + getBookStatus({ + date: "2020-01-01" + }) +).toMatchInlineSnapshot(` { - "date-added": "2020-01-01", + "dateAdded": "2020-01-01", } `); expect(getBookStatus({})).toMatchInlineSnapshot(` { - "date-added": "2023-12-01", + "dateAdded": "2023-12-01", } `); }); diff --git a/src/__tests__/workflow.test.ts b/src/__tests__/workflow.test.ts index 9ca5bbd4..e132fe20 100644 --- a/src/__tests__/workflow.test.ts +++ b/src/__tests__/workflow.test.ts @@ -74,7 +74,7 @@ Undefined: “Luster” "categories": [ "Fiction", ], - "date-added": "2022-10-01", + "dateAdded": "2022-10-01", "description": "NEW YORK TIMES BESTSELLER Winner of the 2020 Center for Fiction First Novel Prize Winner of the 2020 National Book Critics Circle's John Leonard Prize for Best First Book Winner of the 2020 Kirkus Prize for Fiction Winner of the 2021 Dylan Thomas Prize Finalist for the 2021 PEN/Hemingway Award for Best First Novel Longlisted for the 2021 Andrew Carnegie Medal for Excellence in Fiction Longlisted for the 2021 PEN/Jean Stein Book Award Longlisted for the 2021 Women's Prize for Fiction A New York Times Notable Book of the Year Named Best Book of the Year by O: the Oprah Magazine, Vanity Fair, Los Angeles Times, Town and Country, Amazon, Indigo, NPR, Harper’s Bazaar, Kirkus Reviews, Marie Claire, Good Housekeeping Sharp, comic, disruptive, and tender, Luster sees a young Black woman fall into art and someone else's open marriage. Edie is stumbling her way through her twenties—sharing a subpar apartment in Bushwick, clocking in and out of her admin job, making a series of inappropriate sexual choices. She's also, secretly, haltingly, figuring her way into life as an artist. And then she meets Eric, a digital archivist with a family in New Jersey, including an autopsist wife who has agreed to an open marriage—with rules. As if navigating the constantly shifting landscapes of contemporary sexual manners and racial politics weren't hard enough, Edie finds herself unemployed and falling into Eric's family life, his home. She becomes a hesitant friend to his wife and a de facto role model to his adopted daughter. Edie is the only Black woman who young Akila knows. Razor-sharp, darkly comic, sexually charged, socially disruptive, Luster is a portrait of a young woman trying to make sense of her life in a tumultuous era. It is also a haunting, aching description of how hard it is to believe in your own talent and the unexpected influences that bring us into ourselves along the way.", "isbn": "9780385696005", "language": "en", @@ -146,8 +146,8 @@ Undefined: “Luster” "authors": [ "Raven Leilani", ], - "date-started": "2022-10-02", "dateAdded": "2022-10-01", + "dateStarted": "2022-10-02", "description": "Sharp, comic, disruptive, tender, Raven Leilani's debut novel, Luster, sees a young black woman fall into art and someone else's open marriage. Edie is stumbling her way through her twenties--sharing a subpar apartment in Bushwick, clocking in and out of her admin job, making a series of inappropriate sexual choices. She's also, secretly, haltingly, figuring her way into life as an artist. And then she meets Eric, a digital archivist with a family in New Jersey, including an autopsist wife who has agreed to an open marriage--with rules. As if navigating the constantly shifting landscapes of contemporary sexual manners and racial politics weren't hard enough, Edie finds herself unemployed and falling into Eric's family life, his home. She becomes a hesitant friend to his wife and a de facto role model to his adopted daughter. Edie is the only black woman who young Akila knows. Razor sharp, darkly comic, sexually charged, socially disruptive, Luster is a portrait of a young woman trying to make her sense of her life in a tumultuous era. It is also a haunting, aching description of how hard it is to believe in your own talent and the unexpected influences that bring us into ourselves along the way.", "isbn": "9780385696005", "language": "en", @@ -209,7 +209,10 @@ Undefined: “Luster” "# Updated library Finished: “Luster” -undefined + +## 2022 reading summary + +- **Total books:** 1 ", ] `); @@ -221,8 +224,8 @@ undefined "authors": [ "Raven Leilani", ], - "date-finished": "2022-10-03", "dateAdded": "2022-10-01", + "dateFinished": "2022-10-03", "dateStarted": "2022-10-02", "description": "Sharp, comic, disruptive, tender, Raven Leilani's debut novel, Luster, sees a young black woman fall into art and someone else's open marriage. Edie is stumbling her way through her twenties--sharing a subpar apartment in Bushwick, clocking in and out of her admin job, making a series of inappropriate sexual choices. She's also, secretly, haltingly, figuring her way into life as an artist. And then she meets Eric, a digital archivist with a family in New Jersey, including an autopsist wife who has agreed to an open marriage--with rules. As if navigating the constantly shifting landscapes of contemporary sexual manners and racial politics weren't hard enough, Edie finds herself unemployed and falling into Eric's family life, his home. She becomes a hesitant friend to his wife and a de facto role model to his adopted daughter. Edie is the only black woman who young Akila knows. Razor sharp, darkly comic, sexually charged, socially disruptive, Luster is a portrait of a young woman trying to make her sense of her life in a tumultuous era. It is also a haunting, aching description of how hard it is to believe in your own talent and the unexpected influences that bring us into ourselves along the way.", "isbn": "9780385696005", @@ -279,7 +282,7 @@ Undefined: “Don't Let Her Stay” "categories": [ "Estranged families", ], - "date-added": "2022-10-01", + "dateAdded": "2022-10-01", "description": "Someone inside your house wants you dead, but no one believes you...", "isbn": "9798374567144", "language": "en", diff --git a/src/index.ts b/src/index.ts index ebad4e1e..b530d03d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -38,10 +38,10 @@ export type BookParams = { filename: string; bookIsbn: BookPayload["isbn"]; dateType: { - "date-added"?: string; - "date-started"?: string; - "date-finished"?: string; - "date-abandoned"?: string; + dateAdded?: string; + dateStarted?: string; + dateFinished?: string; + dateAbandoned?: string; }; notes?: BookPayload["notes"]; bookStatus: BookStatus; diff --git a/src/utils.ts b/src/utils.ts index 87e4cad2..ef652538 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -54,29 +54,29 @@ export function getBookStatus({ date?: string; bookStatus?: BookStatus; }): { - "date-abandoned"?: string; - "date-started"?: string; - "date-finished"?: string; - "date-added"?: string; + dateAbandoned?: string; + dateStarted?: string; + dateFinished?: string; + dateAdded?: string; } { const dateValue = date ?? localDate(); switch (bookStatus) { case "abandoned": return { - "date-abandoned": dateValue, + dateAbandoned: dateValue, }; case "started": return { - "date-started": dateValue, + dateStarted: dateValue, }; case "finished": return { - "date-finished": dateValue, + dateFinished: dateValue, }; case "want to read": default: { return { - "date-added": dateValue, + dateAdded: dateValue, }; } }