Skip to content

Commit 819c737

Browse files
committed
fix: maybe
1 parent 2cbacf6 commit 819c737

File tree

1 file changed

+27
-19
lines changed

1 file changed

+27
-19
lines changed

test/integration/cli-test.js

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
let { describe, it, before, beforeEach, afterEach } = require('node:test')
1+
let { describe, it, before, beforeEach } = require('node:test')
22
let assert = require('node:assert/strict')
3-
let cli = require('../../src/cli')
3+
let create = require('../../src/index')
44
let { join, resolve } = require('path')
55
let { readFileSync, existsSync, rmSync, mkdirSync } = require('fs')
6+
let { updater } = require('@architect/utils')
67
let tmp = resolve(__dirname, '..', 'tmp')
78

89
// Helper to empty a directory (replaces fs-extra's emptyDirSync)
@@ -14,49 +15,56 @@ function emptyDirSync (dir) {
1415
}
1516

1617
describe('CLI Integration Tests', () => {
17-
let originalArgv
18-
1918
before(() => {
2019
// Ensure tmp directory exists
2120
emptyDirSync(tmp)
22-
// Save original argv
23-
originalArgv = process.argv
2421
})
2522

2623
beforeEach(() => {
2724
// Clean tmp directory before each test
2825
emptyDirSync(tmp)
2926
})
3027

31-
afterEach(() => {
32-
// Restore argv after each test
33-
process.argv = originalArgv
34-
})
35-
3628
it('should build the basic templated node runtime project', async () => {
37-
process.argv = [ 'node', 'test', '--no-install', '--runtime', 'node.js', tmp ]
38-
await cli()
29+
await create({
30+
folder: tmp,
31+
install: false,
32+
runtime: 'node.js',
33+
update: updater('Create'),
34+
})
3935
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'index.mjs')), 'src/http/get-index/index.mjs created')
4036
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime node/), '"runtime node" present somewhere in manifest')
4137
})
4238

4339
it('should build the basic templated deno runtime project', async () => {
44-
process.argv = [ 'node', 'test', '--no-install', '--runtime', 'deno', tmp ]
45-
await cli()
40+
await create({
41+
folder: tmp,
42+
install: false,
43+
runtime: 'deno',
44+
update: updater('Create'),
45+
})
4646
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'mod.ts')), 'src/http/get-index/mod.ts created')
4747
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime deno/), '"runtime deno" present somewhere in manifest')
4848
})
4949

5050
it('should build the basic templated python runtime project', async () => {
51-
process.argv = [ 'node', 'test', '--no-install', '--runtime', 'python', tmp ]
52-
await cli()
51+
await create({
52+
folder: tmp,
53+
install: false,
54+
runtime: 'python',
55+
update: updater('Create'),
56+
})
5357
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.py')), 'src/http/get-index/lambda.py created')
5458
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime python/), '"runtime python" present somewhere in manifest')
5559
})
5660

5761
it('should build the basic templated ruby runtime project', async () => {
58-
process.argv = [ 'node', 'test', '--no-install', '--runtime', 'ruby', tmp ]
59-
await cli()
62+
await create({
63+
folder: tmp,
64+
install: false,
65+
runtime: 'ruby',
66+
update: updater('Create'),
67+
})
6068
assert.ok(existsSync(join(tmp, 'src', 'http', 'get-index', 'lambda.rb')), 'src/http/get-index/lambda.rb created')
6169
assert.ok(readFileSync(join(tmp, 'app.arc'), 'utf-8').match(/runtime ruby/), '"runtime ruby" present somewhere in manifest')
6270
})

0 commit comments

Comments
 (0)