Forráskód Böngészése

refactor: move "types" to types.ts file under "test" folder

refactor: change test greeting to French
refactor: move mocha context augmentations to types.ts file
refactor: nest Greeter tests in "greeter" folder
Paul Razvan Berg 4 éve
szülő
commit
5111f05b2b
4 módosított fájl, 7 hozzáadás és 9 törlés
  1. 1 1
      test/greeter/Greeter.behavior.ts
  2. 1 1
      test/greeter/Greeter.ts
  3. 5 2
      test/types.ts
  4. 0 5
      types/index.ts

+ 1 - 1
test/Greeter.behavior.ts → test/greeter/Greeter.behavior.ts

@@ -5,6 +5,6 @@ export function shouldBehaveLikeGreeter(): void {
     expect(await this.greeter.connect(this.signers.admin).greet()).to.equal("Hello, world!");
     expect(await this.greeter.connect(this.signers.admin).greet()).to.equal("Hello, world!");
 
 
     await this.greeter.setGreeting("Hola, mundo!");
     await this.greeter.setGreeting("Hola, mundo!");
-    expect(await this.greeter.connect(this.signers.admin).greet()).to.equal("Hola, mundo!");
+    expect(await this.greeter.connect(this.signers.admin).greet()).to.equal("Bonjour, le monde!");
   });
   });
 }
 }

+ 1 - 1
test/Greeter.ts → test/greeter/Greeter.ts

@@ -2,7 +2,7 @@ import hre from "hardhat";
 import { Artifact } from "hardhat/types";
 import { Artifact } from "hardhat/types";
 import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
 import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
 
 
-import { Greeter } from "../typechain/Greeter";
+import { Greeter } from "../../typechain/Greeter";
 import { Signers } from "../types";
 import { Signers } from "../types";
 import { shouldBehaveLikeGreeter } from "./Greeter.behavior";
 import { shouldBehaveLikeGreeter } from "./Greeter.behavior";
 
 

+ 5 - 2
types/augmentations.d.ts → test/types.ts

@@ -1,7 +1,6 @@
-// eslint-disable @typescript-eslint/no-explicit-any
+import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
 import { Fixture } from "ethereum-waffle";
 import { Fixture } from "ethereum-waffle";
 
 
-import { Signers } from "./";
 import { Greeter } from "../typechain/Greeter";
 import { Greeter } from "../typechain/Greeter";
 
 
 declare module "mocha" {
 declare module "mocha" {
@@ -11,3 +10,7 @@ declare module "mocha" {
     signers: Signers;
     signers: Signers;
   }
   }
 }
 }
+
+export interface Signers {
+  admin: SignerWithAddress;
+}

+ 0 - 5
types/index.ts

@@ -1,5 +0,0 @@
-import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/dist/src/signer-with-address";
-
-export interface Signers {
-  admin: SignerWithAddress;
-}