Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 87ee8bc

Browse files
committed
use assert.include in tests
1 parent 2898a99 commit 87ee8bc

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

packages/compile-solidity-tests/test/compilerSupplier/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ describe("CompilerSupplier", () => {
202202
assert.fail();
203203
} catch (error) {
204204
let expectedMessageSnippet = "Failed to fetch the Solidity compiler";
205-
assert(error.message.includes(expectedMessageSnippet));
205+
assert.include(error.message, expectedMessageSnippet);
206206
}
207207
});
208208
});
@@ -259,7 +259,7 @@ describe("CompilerSupplier", () => {
259259
assert.fail();
260260
} catch (error) {
261261
let expectedMessageSnippet = "version matching globbity gloop";
262-
assert(error.message.includes(expectedMessageSnippet));
262+
assert.include(error.message, expectedMessageSnippet);
263263
}
264264
});
265265
});

packages/compile-solidity-tests/test/supplier.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,15 @@ describe("CompilerSupplier", function () {
183183
compilerCacheDirectory,
184184
compilerFilename!
185185
);
186-
assert.isTrue(fse.existsSync(cachedCompilerPath), "Should have cached compiler");
186+
assert.isTrue(
187+
fse.existsSync(cachedCompilerPath),
188+
"Should have cached compiler"
189+
);
187190

188191
// Get cached solc access time
189-
const initialAccessTime = (await fse.stat(cachedCompilerPath)).atime.getTime();
192+
const initialAccessTime = (
193+
await fse.stat(cachedCompilerPath)
194+
).atime.getTime();
190195

191196
// Wait a second and recompile, verifying that the cached solc
192197
// got accessed / ran ok.
@@ -197,7 +202,9 @@ describe("CompilerSupplier", function () {
197202
options: cachedOptions
198203
});
199204

200-
const finalAccessTime = (await fse.stat(cachedCompilerPath)).atime.getTime();
205+
const finalAccessTime = (
206+
await fse.stat(cachedCompilerPath)
207+
).atime.getTime();
201208
const NewPragma = findOne("NewPragma", compilations[0].contracts);
202209

203210
assert.equal(NewPragma.contractName, "NewPragma", "Should have compiled");
@@ -227,7 +234,7 @@ describe("CompilerSupplier", function () {
227234
"Version8Pragma",
228235
compilations[0].contracts
229236
); //update when necessary
230-
assert.isTrue(VersionLatestPragma.compiler.version.includes("0.8.")); //update when necessary
237+
assert.include(VersionLatestPragma.compiler.version, "0.8."); //update when necessary
231238
assert.equal(
232239
VersionLatestPragma.contractName,
233240
"Version8Pragma", //update when necessary
@@ -328,7 +335,7 @@ describe("CompilerSupplier", function () {
328335
}
329336

330337
assert.isDefined(error);
331-
assert.isTrue(error.message.includes("option must be"));
338+
assert.include(error.message, "option must be");
332339
});
333340

334341
it("errors if running dockerized solc when image does not exist locally", async function () {
@@ -354,7 +361,7 @@ describe("CompilerSupplier", function () {
354361
}
355362

356363
assert.isDefined(error);
357-
assert.isTrue(error.message.includes(imageName));
364+
assert.include(error.message, imageName);
358365
});
359366
});
360367
});

0 commit comments

Comments
 (0)