Skip to content

Commit 59c6c6e

Browse files
committed
start and stop
1 parent 9226580 commit 59c6c6e

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

test/integration/features/command.feature

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,18 @@ Feature: Bundle server command tests
2929
Given 2 commits are pushed to the remote branch 'main'
3030
When I run the bundle server CLI command 'update integration/bundle'
3131
Then the bundle list is updated
32+
33+
Scenario: The stop command updates the routes file
34+
Given no bundle server repository exists at route 'integration/stop'
35+
Given a new remote repository with main branch 'main'
36+
Given a bundle server repository is created at route 'integration/stop' for the remote
37+
When I run the bundle server CLI command 'stop integration/stop'
38+
Then the route is removed from the routes file
39+
40+
Scenario: The start command updates the routes file
41+
Given no bundle server repository exists at route 'integration/start'
42+
Given a new remote repository with main branch 'main'
43+
Given a bundle server repository is created at route 'integration/start' for the remote
44+
When I run the bundle server CLI command 'stop integration/start'
45+
When I run the bundle server CLI command 'start integration/start'
46+
Then the route exists in the routes file

test/integration/features/step_definitions/bundleServer.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,21 @@ Then('the bundle list is updated', async function (this: BundleServerWorld) {
3030
'Writing updated bundle list\n' +
3131
'Update complete'), true)
3232
})
33+
34+
Then('the route is removed from the routes file', async function (this: BundleServerWorld) {
35+
if (this.route) {
36+
var routesPath = local_utils.routesPath()
37+
var data = fs.readFileSync(routesPath, 'utf-8');
38+
assert.strictEqual(data.includes(this.route), false)
39+
}
40+
})
41+
42+
Then('the route exists in the routes file', async function (this: BundleServerWorld) {
43+
if (this.route) {
44+
var routesPath = local_utils.routesPath()
45+
var data = fs.readFileSync(routesPath, 'utf-8');
46+
assert.strictEqual(data.includes(this.route), true)
47+
} else {
48+
throw new Error("Route not set")
49+
}
50+
})

test/integration/features/support/utils.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ export function routesPath(): string {
2323
// Get path to routes file
2424
return path.resolve(__dirname, "../../../../routes")
2525
}
26+
27+
export function wwwPath(): string {
28+
// Get path to www directory
29+
return path.resolve(__dirname, "../../../../www")
30+
}

0 commit comments

Comments
 (0)