-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Tidy up - linting and dropping custom DeepPartial type
- Loading branch information
1 parent
bda3ed1
commit 5c545c0
Showing
8 changed files
with
34 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,36 +4,33 @@ import app from "../server"; | |
import { queryMock } from "../tests/graphqlQueryMock"; | ||
import { mockLowcalSession, mockTeam } from "../tests/mocks/saveAndReturnMocks"; | ||
import { buildContentFromSessions } from "./resumeApplication"; | ||
import { PartialDeep } from "type-fest"; | ||
|
||
const ENDPOINT = "/resume-application"; | ||
const TEST_EMAIL = "[email protected]"; | ||
|
||
type DeepPartial<T> = T extends object | ||
? { | ||
[P in keyof T]?: DeepPartial<T[P]>; | ||
} | ||
: T; | ||
|
||
const mockFormatRawProjectTypes = jest | ||
.fn() | ||
.mockResolvedValue(["New office premises"]); | ||
|
||
jest.mock("@opensystemslab/planx-core", () => { | ||
const actualCoreDomainClient = jest.requireActual("@opensystemslab/planx-core").CoreDomainClient; | ||
const actualCoreDomainClient = jest.requireActual( | ||
"@opensystemslab/planx-core", | ||
).CoreDomainClient; | ||
|
||
return { | ||
CoreDomainClient: class extends actualCoreDomainClient { | ||
constructor() { | ||
super(); | ||
this.formatRawProjectTypes = () => mockFormatRawProjectTypes(); | ||
} | ||
} | ||
}, | ||
}; | ||
}); | ||
|
||
describe("buildContentFromSessions function", () => { | ||
it("should return correctly formatted content for a single session", async () => { | ||
const sessions: DeepPartial<LowCalSession>[] = [ | ||
const sessions: PartialDeep<LowCalSession>[] = [ | ||
{ | ||
data: { | ||
passport: { | ||
|
@@ -67,7 +64,7 @@ describe("buildContentFromSessions function", () => { | |
}); | ||
|
||
it("should return correctly formatted content for multiple session", async () => { | ||
const sessions: DeepPartial<LowCalSession>[] = [ | ||
const sessions: PartialDeep<LowCalSession>[] = [ | ||
{ | ||
data: { | ||
passport: { | ||
|
@@ -142,7 +139,7 @@ describe("buildContentFromSessions function", () => { | |
}); | ||
|
||
it("should handle an empty address field", async () => { | ||
const sessions: DeepPartial<LowCalSession>[] = [ | ||
const sessions: PartialDeep<LowCalSession>[] = [ | ||
{ | ||
data: { | ||
passport: { | ||
|
@@ -175,7 +172,7 @@ describe("buildContentFromSessions function", () => { | |
|
||
it("should handle an empty project type field", async () => { | ||
mockFormatRawProjectTypes.mockResolvedValueOnce(""); | ||
const sessions: DeepPartial<LowCalSession>[] = [ | ||
const sessions: PartialDeep<LowCalSession>[] = [ | ||
{ | ||
data: { | ||
passport: { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters