Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Add getTimestampOffset/setTimestampOffset utilities #126

Merged
merged 4 commits into from
Jul 7, 2022

Conversation

refi93
Copy link
Contributor

@refi93 refi93 commented Jun 29, 2022

Closes #101

Description

Add getTimeOffset/setTimeOffset utilities, allowing to advance the time while testing smart-contracts, which comes in handy especially when testing some time-based logic

Functionality can be verified by running the utilities unit tests:

npx jest --testMatch="**/dev-test/utilities.test.js"

For contributor use:

  • Targeted PR against master branch
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work
  • Code follows the standards mentioned here
  • Updated relevant documentation
  • Re-reviewed Files changed in the Github PR explorer
  • Added appropriate labels

@refi93 refi93 requested a review from a team as a code owner June 29, 2022 08:43
@changeset-bot
Copy link

changeset-bot bot commented Jun 29, 2022

🦋 Changeset detected

Latest commit: 5ebe4a9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@onflow/flow-js-testing Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@refi93 refi93 force-pushed the refi93/timestamp-offset branch from a463ef0 to e1717d9 Compare June 29, 2022 08:49
const { addressMap = {}, args = [] } = props
const code = await getAccountAddressTemplate(addressMap);

reportMissing("arguments", args.length, 2, `getAccountAddress =>`);

return executeScript({code, ...props})
return executeScript({code, processed: true, ...props})
Copy link
Contributor Author

@refi93 refi93 Jun 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure why this changed, I ran npm run generate-code

@refi93 refi93 changed the title Add getTimeOffset/setTimeOffset utilities Add getTimestampOffset/setTimestampOffset utilities Jun 29, 2022
@jribbink jribbink merged commit 3fc34f3 into onflow:master Jul 7, 2022
@github-actions github-actions bot mentioned this pull request Jul 7, 2022
This was referenced Mar 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Allow blocktimestamp jump in emulator for better testing.
2 participants