Skip to content

Commit

Permalink
test: fix mock typing
Browse files Browse the repository at this point in the history
  • Loading branch information
rpenido committed Sep 14, 2024
1 parent fa81f31 commit 99428bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
14 changes: 12 additions & 2 deletions src/library-authoring/data/api.mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,26 @@ mockCreateLibraryBlock.newHtmlData = {
blockType: 'html',
displayName: 'New Text Component',
hasUnpublishedChanges: true,
lastPublished: null, // or e.g. '2024-08-30T16:37:42Z',
publishedBy: null, // or e.g. 'test_author',
lastDraftCreated: '2024-07-22T21:37:49Z',
lastDraftCreatedBy: null,
created: '2024-07-22T21:37:49Z',
tagsCount: 0,
} satisfies api.CreateBlockDataResponse;
} satisfies api.LibraryBlockMetadata;
mockCreateLibraryBlock.newProblemData = {
id: 'lb:Axim:TEST:problem:prob1',
defKey: 'prob1',
blockType: 'problem',
displayName: 'New Problem',
hasUnpublishedChanges: true,
lastPublished: null, // or e.g. '2024-08-30T16:37:42Z',
publishedBy: null, // or e.g. 'test_author',
lastDraftCreated: '2024-07-22T21:37:49Z',
lastDraftCreatedBy: null,
created: '2024-07-22T21:37:49Z',
tagsCount: 0,
} satisfies api.CreateBlockDataResponse;
} satisfies api.LibraryBlockMetadata;
/** Apply this mock. Returns a spy object that can tell you if it's been called. */
mockCreateLibraryBlock.applyMock = () => (
jest.spyOn(api, 'createLibraryBlock').mockImplementation(mockCreateLibraryBlock)
Expand Down
8 changes: 4 additions & 4 deletions src/library-authoring/data/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ export interface LibraryBlockMetadata {
defKey: string | null;
displayName: string;
lastPublished: string | null;
publishedBy: null,
lastDraftCreated: null,
lastDraftCreatedBy: null,
publishedBy: string | null,
lastDraftCreated: string | null,
lastDraftCreatedBy: string | null,
hasUnpublishedChanges: boolean;
created: '2024-06-20T13:54:21Z',
created: string | null,
tagsCount: number;
}

Expand Down

0 comments on commit 99428bc

Please sign in to comment.