ic-tube/frontend/indexer/tests/ourtube-utils.ts
2024-08-01 22:50:01 +03:00

60 lines
1.8 KiB
TypeScript

import { newMockEvent } from "matchstick-as"
import { ethereum, BigInt, Address } from "@graphprotocol/graph-ts"
import { VideoUploaded } from "../generated/Ourtube/Ourtube"
export function createVideoUploadedEvent(
id: BigInt,
hash: string,
title: string,
description: string,
location: string,
category: string,
thumbnailHash: string,
isAudio: boolean,
date: string,
author: Address
): VideoUploaded {
let videoUploadedEvent = changetype<VideoUploaded>(newMockEvent())
videoUploadedEvent.parameters = new Array()
videoUploadedEvent.parameters.push(
new ethereum.EventParam("id", ethereum.Value.fromUnsignedBigInt(id))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("hash", ethereum.Value.fromString(hash))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("title", ethereum.Value.fromString(title))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam(
"description",
ethereum.Value.fromString(description)
)
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("location", ethereum.Value.fromString(location))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("category", ethereum.Value.fromString(category))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam(
"thumbnailHash",
ethereum.Value.fromString(thumbnailHash)
)
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("isAudio", ethereum.Value.fromBoolean(isAudio))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("date", ethereum.Value.fromString(date))
)
videoUploadedEvent.parameters.push(
new ethereum.EventParam("author", ethereum.Value.fromAddress(author))
)
return videoUploadedEvent
}