-
+
)
}
\ No newline at end of file
diff --git a/packages/library/src/modules/Graph/core/types.ts b/packages/library/src/modules/Graph/core/types.ts
index 267a02ea..c5a9acba 100644
--- a/packages/library/src/modules/Graph/core/types.ts
+++ b/packages/library/src/modules/Graph/core/types.ts
@@ -1,3 +1,3 @@
import { Canvas2DGraphProps, HTMLGridGraphProps } from 'modules/Graph'
-export type GraphCoreProps = HTMLGridGraphProps & Canvas2DGraphProps
\ No newline at end of file
+export type GraphCoreProps = HTMLGridGraphProps & Canvas2DGraphProps
\ No newline at end of file
diff --git a/packages/library/src/modules/Graph/strategies/Grid/types.ts b/packages/library/src/modules/Graph/strategies/Grid/types.ts
index 083cc191..75c46053 100644
--- a/packages/library/src/modules/Graph/strategies/Grid/types.ts
+++ b/packages/library/src/modules/Graph/strategies/Grid/types.ts
@@ -5,14 +5,14 @@ import { Commit } from 'types/Commit'
* A function that returns a custom implementation
* for the commit node in the graph.
*/
-export type CustomCommitNode = (props: CustomCommitNodeProps) => ReactElement
+export type CustomCommitNode = (props: CustomCommitNodeProps) => ReactElement
-export interface CustomCommitNodeProps {
+export interface CustomCommitNodeProps {
/**
* Details of the commit that this node
* represents.
*/
- commit: Commit
+ commit: Commit
/**
* The colour of the node based on the
diff --git a/packages/library/src/modules/Graph/types.ts b/packages/library/src/modules/Graph/types.ts
index dcaba242..6b898be3 100644
--- a/packages/library/src/modules/Graph/types.ts
+++ b/packages/library/src/modules/Graph/types.ts
@@ -5,7 +5,7 @@ export type GraphOrientation = 'normal' | 'flipped'
export type Canvas2DGraphProps = GraphPropsCommon
-export interface HTMLGridGraphProps extends GraphPropsCommon {
+export interface HTMLGridGraphProps extends GraphPropsCommon {
/**
* Whether to show the commit hash
* to the side of the node in the graph.
@@ -22,7 +22,7 @@ export interface HTMLGridGraphProps extends GraphPropsCommon {
* Overrides the commit nodes with a
* custom implementation.
*/
- node?: CustomCommitNode
+ node?: CustomCommitNode
/**
* The height, in pixels, of the background
diff --git a/packages/library/src/modules/Table/Table.spec.tsx b/packages/library/src/modules/Table/Table.spec.tsx
index 9e0cb842..1d46936e 100644
--- a/packages/library/src/modules/Table/Table.spec.tsx
+++ b/packages/library/src/modules/Table/Table.spec.tsx
@@ -4,8 +4,21 @@ import { table } from 'test/elements/Table'
import { Table } from 'modules/Table/Table'
import * as gitContext from 'context/GitContext'
import { commit, gitContextBag, graphData } from 'test/stubs'
+import { afterEach, beforeEach } from 'vitest'
+import { Commit } from 'types/Commit'
+
+const today = Date.UTC(2025, 2, 24, 18, 0, 0)
describe('Table', () => {
+ beforeEach(() => {
+ vi.useFakeTimers()
+ vi.setSystemTime(today)
+ })
+
+ afterEach(() => {
+ vi.useRealTimers()
+ })
+
it('should pass the given table class to the git log table element', () => {
render(
{
+ customRowFunction(commit)
+ return
+ }}
+ />
+ )
+
+ expect(customRowFunction).toHaveBeenCalledWith[]>({
+ authorDate: '2025-02-22 22:06:22 +0000',
+ branch: 'refs/remotes/origin/gh-pages',
+ children: [
+ '30ee0ba',
+ ],
+ committerDate: '2025-02-24T22:06:22+00:00',
+ customField: 'test',
+ hash: '1',
+ isBranchTip: false,
+ message: 'feat(graph): example commit message',
+ parents: [
+ 'afdb263',
+ ]
+ })
+ })
})
\ No newline at end of file
diff --git a/packages/library/src/types.ts b/packages/library/src/types.ts
index ede01e90..c9d6c6e2 100644
--- a/packages/library/src/types.ts
+++ b/packages/library/src/types.ts
@@ -3,12 +3,12 @@ import { ThemeColours, ThemeMode } from './hooks/useTheme/types'
import { GitLogEntry } from './types/GitLogEntry'
import { Commit } from './types/Commit'
-interface GitLogCommonProps {
+interface GitLogCommonProps {
/**
* The git log entries to visualise
* on the graph.
*/
- entries: GitLogEntry[]
+ entries: GitLogEntry[]
/**
* A list of SHA1 commit hashes that belong
@@ -104,7 +104,7 @@ interface GitLogCommonProps {
*
* @param commit Details of the selected commit.
*/
- onSelectCommit?: (commit?: Commit) => void
+ onSelectCommit?: (commit?: Commit) => void
/**
* A callback function invoked when a commit
@@ -116,7 +116,7 @@ interface GitLogCommonProps {
*
* @param commit Details of the previewed commit.
*/
- onPreviewCommit?: (commit?: Commit) => void
+ onPreviewCommit?: (commit?: Commit) => void
/**
* Enables the row styling across the log
@@ -142,7 +142,7 @@ interface GitLogCommonProps {
classes?: GitLogStylingProps
}
-export interface GitLogProps extends GitLogCommonProps {
+export interface GitLogProps extends GitLogCommonProps {
/**
* The name of the branch that is
* currently checked out.
@@ -168,7 +168,7 @@ export interface GitLogProps extends GitLogCommonProps {
paging?: GitLogPaging
}
-export interface GitLogPagedProps extends GitLogCommonProps {
+export interface GitLogPagedProps extends GitLogCommonProps {
/**
* The name of the branch in which the Git log
* entries belong to.
diff --git a/packages/library/src/types/Commit.ts b/packages/library/src/types/Commit.ts
index 30132566..0cdc59de 100644
--- a/packages/library/src/types/Commit.ts
+++ b/packages/library/src/types/Commit.ts
@@ -1,7 +1,4 @@
-/**
- * Represents a commit in the Git history.
- */
-export interface Commit {
+export interface CommitBase {
/**
* The unique hash (SHA) identifying the commit.
*/
@@ -55,7 +52,7 @@ export interface Commit {
/**
* Indicates whether this commit is the
- * tip (latest commit) of its branch.
+ * tip (the latest commit) of its branch.
*/
isBranchTip: boolean
}
@@ -73,4 +70,9 @@ export interface CommitAuthor {
* The email address of the commit author.
*/
email?: string;
-}
\ No newline at end of file
+}
+
+/**
+ * Represents a commit in the Git history.
+ */
+export type Commit = CommitBase & T
\ No newline at end of file
diff --git a/packages/library/src/types/GitLogEntry.ts b/packages/library/src/types/GitLogEntry.ts
index 3fdb9a0c..3b584908 100644
--- a/packages/library/src/types/GitLogEntry.ts
+++ b/packages/library/src/types/GitLogEntry.ts
@@ -1,9 +1,6 @@
import { CommitAuthor } from './Commit'
-/**
- * Represents a single entry in the git log.
- */
-export interface GitLogEntry {
+export interface GitLogEntryBase {
/**
* The unique hash identifier of the commit.
*/
@@ -36,7 +33,7 @@ export interface GitLogEntry {
/**
* The date and time when the commit was applied by the committer.
*
- * This is typically the timestamp when the commit was finalized.
+ * This is typically the timestamp when the commit was finalised.
*/
committerDate: string
@@ -46,4 +43,13 @@ export interface GitLogEntry {
* This may differ from `committerDate` if the commit was rebased or amended.
*/
authorDate?: string
-}
\ No newline at end of file
+}
+
+/**
+ * Represents a single entry in the git log.
+ *
+ * You can pass extra information in the generic
+ * type, and it will be passed back to you in any
+ * relevant callback functions.
+ */
+export type GitLogEntry = GitLogEntryBase & T
\ No newline at end of file