Skip to content

Commit 82c8500

Browse files
committed
fix: adjusting test script
1 parent b9cd18f commit 82c8500

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ lib: ${SRC_FILES} package.json tsconfig.json node_modules rollup.config.js
88
@${BIN}/rollup -c && touch lib
99

1010
.PHONY: test
11-
test: node_modules
11+
test: node_modules lib
1212
@WHARFKIT_TEST=1 TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR='./test/data/requests' \
1313
${BIN}/mocha ${MOCHA_OPTS} ${TEST_FILES} --no-timeout --grep '$(grep)' --exit
1414

1515
.PHONY: ci-test
16-
ci-test: node_modules
16+
ci-test: node_modules lib
1717
@WHARFKIT_TEST=1 TS_NODE_PROJECT='./test/tsconfig.json' MOCK_DIR='./test/data/requests' \
1818
${BIN}/nyc ${NYC_OPTS} --reporter=text \
1919
${BIN}/mocha ${MOCHA_OPTS} -R list ${TEST_FILES} --no-timeout --exit

test/tests/e2e-workflow.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,15 @@ function getTransactionExpiration(): string {
2424
return now.toISOString().slice(0, 19) // Remove milliseconds and timezone
2525
}
2626

27+
function getRandomName(prefix: string): string {
28+
const chars = 'abcdefghijklmnopqrstuvwxyz12345'
29+
let result = prefix
30+
for (let i = 0; i < 6; i++) {
31+
result += chars.charAt(Math.floor(Math.random() * chars.length))
32+
}
33+
return result
34+
}
35+
2736
suite('E2E Workflow', () => {
2837
const cliPath = path.join(__dirname, '../../lib/cli.js')
2938
let testDir: string
@@ -327,7 +336,7 @@ suite('E2E Workflow', () => {
327336

328337
suite('Integration: Account and Deployment', () => {
329338
test('can create an account on the local chain', function () {
330-
const accountName = 'acc' + Math.random().toString(36).substring(2, 8)
339+
const accountName = getRandomName('acc')
331340
const output = execSync(`node ${cliPath} wallet account create --name ${accountName}`, {
332341
encoding: 'utf8',
333342
})
@@ -346,7 +355,7 @@ suite('E2E Workflow', () => {
346355
}
347356

348357
// 1. Create an account
349-
const accountName = 'deploy' + Math.random().toString(36).substring(2, 8)
358+
const accountName = getRandomName('deploy')
350359
execSync(`node ${cliPath} wallet account create --name ${accountName}`, {
351360
encoding: 'utf8',
352361
})
@@ -388,7 +397,7 @@ suite('E2E Workflow', () => {
388397
this.skip()
389398
}
390399

391-
const accountName = 'val' + Math.random().toString(36).substring(2, 8)
400+
const accountName = getRandomName('val')
392401
execSync(`node ${cliPath} wallet account create --name ${accountName}`, {
393402
encoding: 'utf8',
394403
})

0 commit comments

Comments
 (0)