Skip to content

Commit

Permalink
refactor: npx eslint (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahna-ashina committed Oct 22, 2023
1 parent 44c1e47 commit f3d6324
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require('dotenv').config()
import { HardhatUserConfig, task } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
require("dotenv").config();

// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
Expand Down
31 changes: 14 additions & 17 deletions test/GitHubUsernames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "chai";
import { ethers } from "hardhat";
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";

describe("GitHubUsernames", function() {
describe("GitHubUsernames", function () {
async function deploymentFixture() {
console.log("deploymentFixture");

Expand All @@ -29,40 +29,37 @@ describe("GitHubUsernames", function() {
return { owner, otherAccount, githubUsernames };
}

it("usernames empty", async function() {
const { owner, githubUsernames } = await loadFixture(
deploymentFixture
);
it("usernames empty", async function () {
const { owner, githubUsernames } = await loadFixture(deploymentFixture);

const username = await githubUsernames.usernames(owner.address);
console.log("username:", username);
expect(username).to.equal("");
});

it("updateUsername - citizen with valid passport", async function() {
const { owner, githubUsernames } = await loadFixture(
deploymentFixture
);
it("updateUsername - citizen with valid passport", async function () {
const { owner, githubUsernames } = await loadFixture(deploymentFixture);

const tx = await githubUsernames.updateUsername("New Username");
console.log('tx:', tx);
console.log("tx:", tx);

const usernameAfterUpdate = await githubUsernames.usernames(owner.address);
console.log("usernameAfterUpdate:", usernameAfterUpdate);
expect(usernameAfterUpdate).to.equal("New Username");
});

it("updateUsername - citizen with expired passport", async function() {
it("updateUsername - citizen with expired passport", async function () {
const { otherAccount, githubUsernames } = await loadFixture(
deploymentFixture
);

await expect(githubUsernames.connect(otherAccount).updateUsername("Other Username")).to.be.revertedWithCustomError(
githubUsernames,
"PassportExpired"
);

const usernameAfterUpdate = await githubUsernames.usernames(otherAccount.address);
await expect(
githubUsernames.connect(otherAccount).updateUsername("Other Username")
).to.be.revertedWithCustomError(githubUsernames, "PassportExpired");

const usernameAfterUpdate = await githubUsernames.usernames(
otherAccount.address
);
console.log("usernameAfterUpdate:", usernameAfterUpdate);
expect(usernameAfterUpdate).to.equal("");
});
Expand Down

0 comments on commit f3d6324

Please sign in to comment.