Skip to content

Commit 612e5ec

Browse files
committed
expect(await instead of await expect(
Signed-off-by: Jeromy Cannon <[email protected]>
1 parent f4e522e commit 612e5ec

12 files changed

+42
-42
lines changed

test/e2e/commands/account.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
121121
it('should create account with no options', async () => {
122122
try {
123123
argv[flags.amount.name] = 200
124-
await expect(accountCmd.create(argv)).to.eventually.be.ok
124+
expect(await accountCmd.create(argv)).to.be.true
125125

126126
// @ts-ignore to access the private property
127127
const accountInfo = accountCmd.accountInfo
@@ -146,7 +146,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
146146
argv[flags.amount.name] = 777
147147
configManager.update(argv)
148148

149-
await expect(accountCmd.create(argv)).to.eventually.be.ok
149+
expect(await accountCmd.create(argv)).to.be.true
150150

151151
// @ts-ignore to access the private property
152152
const accountInfo = accountCmd.accountInfo
@@ -168,7 +168,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
168168
argv[flags.accountId.name] = accountId1
169169
configManager.update(argv)
170170

171-
await expect(accountCmd.update(argv)).to.eventually.be.ok
171+
expect(await accountCmd.update(argv)).to.be.true
172172

173173
// @ts-ignore to access the private property
174174
const accountInfo = accountCmd.accountInfo
@@ -190,7 +190,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
190190
argv[flags.amount.name] = 333
191191
configManager.update(argv)
192192

193-
await expect(accountCmd.update(argv)).to.eventually.be.ok
193+
expect(await accountCmd.update(argv)).to.be.true
194194

195195
// @ts-ignore to access the private property
196196
const accountInfo = accountCmd.accountInfo
@@ -210,7 +210,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
210210
argv[flags.accountId.name] = accountId1
211211
configManager.update(argv)
212212

213-
await expect(accountCmd.get(argv)).to.eventually.be.ok
213+
expect(await accountCmd.get(argv)).to.be.true
214214
// @ts-ignore to access the private property
215215
const accountInfo = accountCmd.accountInfo
216216
expect(accountInfo).not.to.be.null
@@ -229,7 +229,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
229229
argv[flags.accountId.name] = accountId2
230230
configManager.update(argv)
231231

232-
await expect(accountCmd.get(argv)).to.eventually.be.ok
232+
expect(await accountCmd.get(argv)).to.be.true
233233
// @ts-ignore to access the private property
234234
const accountInfo = accountCmd.accountInfo
235235
expect(accountInfo).not.to.be.null
@@ -251,7 +251,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
251251
argv[flags.setAlias.name] = true
252252
configManager.update(argv)
253253

254-
await expect(accountCmd.create(argv)).to.eventually.be.ok
254+
expect(await accountCmd.create(argv)).to.be.true
255255

256256
// @ts-ignore to access the private property
257257
const newAccountInfo = accountCmd.accountInfo

test/e2e/commands/cluster.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe('ClusterCommand', () => {
8282

8383
it('should cleanup existing deployment', async () => {
8484
if (await chartManager.isChartInstalled(constants.SOLO_SETUP_NAMESPACE, constants.SOLO_CLUSTER_SETUP_CHART)) {
85-
await expect(clusterCmd.reset(argv)).to.eventually.be.ok
85+
expect(await clusterCmd.reset(argv)).to.be.true
8686
}
8787
}).timeout(MINUTES)
8888

@@ -95,7 +95,7 @@ describe('ClusterCommand', () => {
9595
it('solo cluster setup should work with valid args', async () => {
9696
argv[flags.clusterSetupNamespace.name] = namespace
9797
configManager.update(argv)
98-
await expect(clusterCmd.setup(argv)).to.eventually.be.ok
98+
expect(await clusterCmd.setup(argv)).to.be.true
9999
}).timeout(MINUTES)
100100

101101
it('function getClusterInfo should return true', () => {
@@ -127,6 +127,6 @@ describe('ClusterCommand', () => {
127127
it('solo cluster reset should work with valid args', async () => {
128128
argv[flags.clusterSetupNamespace.name] = namespace
129129
configManager.update(argv)
130-
await expect(clusterCmd.reset(argv)).to.eventually.be.ok
130+
expect(await clusterCmd.reset(argv)).to.be.true
131131
}).timeout(MINUTES)
132132
})

test/e2e/commands/mirror_node.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
8484

8585
it('mirror node deploy should success', async () => {
8686
try {
87-
await expect(mirrorNodeCmd.deploy(argv)).to.eventually.be.ok
87+
expect(await mirrorNodeCmd.deploy(argv)).to.be.true
8888
} catch (e) {
8989
mirrorNodeCmd.logger.showUserError(e)
9090
expect.fail()
@@ -113,7 +113,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
113113

114114
// check if mirror node api server is running
115115
const apiURL = 'http://127.0.0.1:8080/api/v1/transactions'
116-
await expect(downloader.urlExists(apiURL)).to.eventually.be.ok
116+
expect(await downloader.urlExists(apiURL)).to.be.true
117117
await sleep(2 * SECONDS)
118118
} catch (e) {
119119
mirrorNodeCmd.logger.showUserError(e)
@@ -124,7 +124,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
124124
it('Explorer GUI should be running', async () => {
125125
try {
126126
const guiURL = 'http://127.0.0.1:8080/localnet/dashboard'
127-
await expect(downloader.urlExists(guiURL)).to.eventually.be.ok
127+
expect(await downloader.urlExists(guiURL)).to.be.true
128128
await sleep(2 * SECONDS)
129129

130130
mirrorNodeCmd.logger.debug('mirror node API and explorer GUI are running')
@@ -203,7 +203,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
203203

204204
it('mirror node destroy should success', async () => {
205205
try {
206-
await expect(mirrorNodeCmd.destroy(argv)).to.eventually.be.ok
206+
expect(await mirrorNodeCmd.destroy(argv)).to.be.true
207207
} catch (e) {
208208
mirrorNodeCmd.logger.showUserError(e)
209209
expect.fail()

test/e2e/commands/network.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,12 @@ describe('NetworkCommand', () => {
7878
})
7979

8080
it('keys should be generated', async () => {
81-
await expect(nodeCmd.handlers.keys(argv)).to.eventually.be.ok
81+
expect(await nodeCmd.handlers.keys(argv)).to.be.true
8282
})
8383

8484
it('network deploy command should succeed', async () => {
8585
try {
86-
await expect(networkCmd.deploy(argv)).to.eventually.be.ok
86+
expect(await networkCmd.deploy(argv)).to.be.true
8787

8888
// check pod names should match expected values
8989
await expect(k8.getPodByName('network-node1-0'))
@@ -129,7 +129,7 @@ describe('NetworkCommand', () => {
129129
configManager.update(argv)
130130

131131
try {
132-
await expect(networkCmd.destroy(argv)).to.eventually.be.ok
132+
expect(await networkCmd.destroy(argv)).to.be.true
133133

134134
while ((await k8.getPodsByLabel(['solo.hedera.com/type=network-node'])).length > 0) {
135135
networkCmd.logger.debug('Pods are still running. Waiting...')
@@ -142,8 +142,8 @@ describe('NetworkCommand', () => {
142142
}
143143

144144
// check if chart is uninstalled
145-
await expect(bootstrapResp.opts.chartManager.isChartInstalled(namespace, constants.SOLO_DEPLOYMENT_CHART))
146-
.to.eventually.not.be.ok
145+
expect(await bootstrapResp.opts.chartManager.isChartInstalled(namespace, constants.SOLO_DEPLOYMENT_CHART))
146+
.to.be.true
147147

148148
// check if pvc are deleted
149149
await expect(k8.listPvcsByNamespace(namespace)).eventually.to.have.lengthOf(0)

test/e2e/commands/relay.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
6161

6262
// test relay deploy
6363
try {
64-
await expect(relayCmd.deploy(argv)).to.eventually.be.ok
64+
expect(await relayCmd.deploy(argv)).to.be.true
6565
} catch (e) {
6666
relayCmd.logger.showUserError(e)
6767
expect.fail()
@@ -75,7 +75,7 @@ e2eTestSuite(testName, argv, undefined, undefined, undefined, undefined, undefin
7575

7676
// test relay destroy
7777
try {
78-
await expect(relayCmd.destroy(argv)).to.eventually.be.ok
78+
expect(await relayCmd.destroy(argv)).to.be.true
7979
} catch (e) {
8080
relayCmd.logger.showUserError(e)
8181
expect.fail()

test/e2e/e2e_node_util.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ export function e2eNodeKeyRefreshTest (testName: string, mode: string, releaseTa
7777

7878
it(`Node Proxy should be UP [mode ${mode}, release ${releaseTag}`, async () => {
7979
try {
80-
await expect(k8.waitForPodReady(
80+
expect(await k8.waitForPodReady(
8181
['app=haproxy-node1',
8282
'solo.hedera.com/type=haproxy'],
83-
1, 300, 1000)).to.eventually.be.ok
83+
1, 300, 1000)).to.be.true
8484
} catch (e) {
8585
nodeCmd.logger.showUserError(e)
8686
expect.fail()
@@ -103,7 +103,7 @@ export function e2eNodeKeyRefreshTest (testName: string, mode: string, releaseTa
103103
expect(resp.response.statusCode).to.equal(200)
104104
await sleep(20 * SECONDS) // sleep to wait for pod to finish terminating
105105
} else if (mode === 'stop') {
106-
await expect(nodeCmd.handlers.stop(argv)).to.eventually.be.ok
106+
expect(await nodeCmd.handlers.stop(argv)).to.be.true
107107
await sleep(20 * SECONDS) // give time for node to stop and update its logs
108108
} else {
109109
throw new Error(`invalid mode: ${mode}`)
@@ -125,8 +125,8 @@ export function e2eNodeKeyRefreshTest (testName: string, mode: string, releaseTa
125125
it(`${nodeAlias} should be running`, async () => {
126126
try {
127127
// @ts-ignore to access tasks which is a private property
128-
await expect(nodeCmd.tasks.checkNetworkNodePod(namespace,
129-
nodeAlias)).to.eventually.be.ok
128+
expect(await nodeCmd.tasks.checkNetworkNodePod(namespace,
129+
nodeAlias)).to.be.true
130130
} catch (e) {
131131
nodeCmd.logger.showUserError(e)
132132
expect.fail()
@@ -139,7 +139,7 @@ export function e2eNodeKeyRefreshTest (testName: string, mode: string, releaseTa
139139
function nodeRefreshShouldSucceed (nodeAlias: NodeAlias, nodeCmd: NodeCommand, argv: Record<any, any>) {
140140
it(`${nodeAlias} refresh should succeed`, async () => {
141141
try {
142-
await expect(nodeCmd.handlers.refresh(argv)).to.eventually.be.ok
142+
expect(await nodeCmd.handlers.refresh(argv)).to.be.true
143143
expect(nodeCmd.getUnusedConfigs(
144144
NodeCommandConfigs.REFRESH_CONFIGS_NAME)).to.deep.equal([
145145
flags.devMode.constName,

test/e2e/integration/core/dependency_managers/helm_dependency_manager.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ describe('HelmDependencyManager', () => {
7171
helmDependencyManager.uninstall()
7272
expect(helmDependencyManager.isInstalled()).not.to.be.ok
7373

74-
await expect(helmDependencyManager.install(getTestCacheDir())).to.eventually.be.ok
74+
expect(await helmDependencyManager.install(getTestCacheDir())).to.be.true
7575
expect(helmDependencyManager.isInstalled()).to.be.ok
7676

7777
fs.rmSync(tmpDir, { recursive: true })

test/e2e/integration/core/k8_e2e.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ describe('K8', () => {
134134

135135
it('should be able to create and delete a namespaces', async () => {
136136
const name = uuid4()
137-
await expect(k8.createNamespace(name)).to.eventually.be.ok
138-
await expect(k8.deleteNamespace(name)).to.eventually.be.ok
137+
expect(await k8.createNamespace(name)).to.be.true
138+
expect(await k8.deleteNamespace(name)).to.be.true
139139
}).timeout(defaultTimeout)
140140

141141
it('should be able to run wait for pod', async () => {
@@ -178,7 +178,7 @@ describe('K8', () => {
178178
it('should be able to check if a path is directory inside a container', async () => {
179179
const pods = await k8.getPodsByLabel([`app=${podLabelValue}`])
180180
const podName = pods[0].metadata.name
181-
await expect(k8.hasDir(podName, containerName, '/tmp')).to.eventually.be.ok
181+
expect(await k8.hasDir(podName, containerName, '/tmp')).to.be.true
182182
}).timeout(defaultTimeout)
183183

184184
const testCases = [ 'test/data/pem/keys/a-private-node0.pem', 'test/data/build-v0.54.0-alpha.4.zip' ]
@@ -197,10 +197,10 @@ describe('K8', () => {
197197
const originalStat = fs.statSync(localFilePath)
198198

199199
// upload the file
200-
await expect(k8.copyTo(podName, containerName, localFilePath, remoteTmpDir)).to.eventually.be.ok
200+
expect(await k8.copyTo(podName, containerName, localFilePath, remoteTmpDir)).to.be.true
201201

202202
// download the same file
203-
await expect(k8.copyFrom(podName, containerName, remoteFilePath, localTmpDir)).to.eventually.be.ok
203+
expect(await k8.copyFrom(podName, containerName, remoteFilePath, localTmpDir)).to.be.true
204204
const downloadedFilePath = path.join(localTmpDir, fileName)
205205
const downloadedFileData = fs.readFileSync(downloadedFilePath)
206206
const downloadedFileHash = crypto.createHash('sha384').update(downloadedFileData).digest('hex')

test/e2e/integration/core/platform_installer_e2e.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ e2eTestSuite(namespace, argv, undefined, undefined, undefined, undefined, undefi
9898
}).timeout(defaultTimeout)
9999

100100
it('should succeed with valid tag and pod', async () => {
101-
await expect(installer.fetchPlatform(podName, packageVersion)).to.eventually.be.ok
101+
expect(await installer.fetchPlatform(podName, packageVersion)).to.be.true
102102
const outputs = await k8.execContainer(podName, constants.ROOT_CONTAINER, `ls -la ${constants.HEDERA_HAPI_PATH}`)
103103
testLogger.showUser(outputs)
104104
}).timeout(MINUTES)

test/test_add.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function testNodeAdd (localBuildPath: string, testDescription = 'Node add
7676
}).timeout(defaultTimeout)
7777

7878
it('should succeed with init command', async () => {
79-
await expect(accountCmd.init(argv)).to.eventually.be.ok
79+
expect(await accountCmd.init(argv)).to.be.true
8080
}).timeout(8 * MINUTES)
8181

8282
it('should add a new node to the network successfully', async () => {

test/test_util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export function e2eTestSuite (
243243
}).timeout(2 * MINUTES)
244244

245245
it('generate key files', async () => {
246-
await expect(nodeCmd.handlers.keys(argv)).to.eventually.be.ok
246+
expect(await nodeCmd.handlers.keys(argv)).to.be.true
247247
expect(nodeCmd.getUnusedConfigs(NodeCommandConfigs.KEYS_CONFIGS_NAME)).to.deep.equal([
248248
flags.devMode.constName,
249249
flags.quiet.constName
@@ -274,7 +274,7 @@ export function e2eTestSuite (
274274
it('should succeed with node setup command', async () => {
275275
// cache this, because `solo node setup.finalize()` will reset it to false
276276
try {
277-
await expect(nodeCmd.handlers.setup(argv)).to.eventually.be.ok
277+
expect(await nodeCmd.handlers.setup(argv)).to.be.true
278278
expect(nodeCmd.getUnusedConfigs(NodeCommandConfigs.SETUP_CONFIGS_NAME)).to.deep.equal([
279279
flags.devMode.constName
280280
])
@@ -286,7 +286,7 @@ export function e2eTestSuite (
286286

287287
it('should succeed with node start command', async () => {
288288
try {
289-
await expect(nodeCmd.handlers.start(argv)).to.eventually.be.ok
289+
expect(await nodeCmd.handlers.start(argv)).to.be.true
290290
} catch (e) {
291291
nodeCmd.logger.showUserError(e)
292292
expect.fail()

test/unit/core/key_manager.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ describe('KeyManager', () => {
4545
expect(nodeKey.privateKey.algorithm).to.deep.equal(signingKey.privateKey.algorithm)
4646
expect(nodeKey.privateKey.type).to.deep.equal(signingKey.privateKey.type)
4747

48-
await expect(signingKey.certificate.verify({
48+
expect(await signingKey.certificate.verify({
4949
publicKey: signingKey.certificate.publicKey,
5050
signatureOnly: true
51-
})).to.eventually.be.ok
51+
})).to.be.true
5252

5353
fs.rmSync(tmpDir, { recursive: true })
5454
})
@@ -72,10 +72,10 @@ describe('KeyManager', () => {
7272
expect(nodeKey.privateKey.algorithm).to.deep.equal(tlsKey.privateKey.algorithm)
7373
expect(nodeKey.privateKey.type).to.deep.equal(tlsKey.privateKey.type)
7474

75-
await expect(tlsKey.certificate.verify({
75+
expect(await tlsKey.certificate.verify({
7676
publicKey: tlsKey.certificate.publicKey,
7777
signatureOnly: true
78-
})).to.eventually.be.ok
78+
})).to.be.true
7979

8080
fs.rmSync(tmpDir, { recursive: true })
8181
}).timeout(20 * SECONDS)

0 commit comments

Comments
 (0)