Skip to content

Instantly share code, notes, and snippets.

@Dustin4444
Created May 17, 2026 06:40
Show Gist options
  • Select an option

  • Save Dustin4444/29f17fda7a6c3a59c3cea1ac0bc2876d to your computer and use it in GitHub Desktop.

Select an option

Save Dustin4444/29f17fda7a6c3a59c3cea1ac0bc2876d to your computer and use it in GitHub Desktop.
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.34+commit.80d5c536.js&optimize=undefined&runs=200&gist=
'use strict';
import { expect } from "chai";
import { ethers } from "hardhat";
describe("Storage", function () {
let storageContract;
let owner;
before(async () => {
[owner] = await ethers.getSigners();
const Storage = await ethers.getContractFactory("Storage");
storageContract = await Storage.deploy();
await storageContract.waitForDeployment();
});
it("Should store and retrieve a value", async function () {
const testValue = 42;
await storageContract.store(testValue);
const retrievedValue = await storageContract.retrieve();
expect(retrievedValue).to.equal(testValue);
});
it("Should update stored value", async function () {
const newValue = 100;
await storageContract.store(newValue);
const updatedValue = await storageContract.retrieve();
expect(updatedValue).to.equal(newValue);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment