Skip to content
This repository was archived by the owner on Dec 9, 2023. It is now read-only.

Commit bb27148

Browse files
committed
allow override of Assessment timestmaps when mocking
1 parent 3d8f31e commit bb27148

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/store_mocks.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { randomBytes } from 'crypto'
33
import { TestScheduler } from 'rxjs/testing'
44
import equal from 'fast-deep-equal/es6'
5+
import type { Timestamp } from '@holochain/client'
56

67
import {
78
SensemakerStore, SensemakerService,
@@ -77,14 +78,14 @@ const mockHash = (prefix) => {
7778
export const mockEh = () => mockHash(HOLOHASH_PREFIX_ENTRY)
7879
export const mockAgentKey = () => mockHash(HOLOHASH_PREFIX_AGENT)
7980

80-
export const mockAssessment = (val: RangeValue, rEh?: Uint8Array | 0, dEh?: Uint8Array | 0) => ({
81+
export const mockAssessment = (val: RangeValue, rEh?: Uint8Array | 0, dEh?: Uint8Array | 0, time: null | Timestamp = null) => ({
8182
resource_eh: rEh || mockEh(),
8283
dimension_eh: dEh || mockEh(),
8384
resource_def_eh: mockEh(),
8485
maybe_input_dataset: null,
8586
value: val,
8687
author: mockEh(),
87-
timestamp: Date.now(),
88+
timestamp: time || Date.now(),
8889
})
8990

9091
interface MockableStore extends SensemakerStore {

0 commit comments

Comments
 (0)