Skip to content
This repository has been archived by the owner on May 28, 2023. It is now read-only.

Commit

Permalink
fix(worker): update debian changelog write path location
Browse files Browse the repository at this point in the history
  • Loading branch information
btkostner committed Jul 1, 2018
1 parent ef51a92 commit eb43d9e
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 7 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
"require": [
"./test/bootstrap.js",
"ts-node/register"
]
],
"snapshotDir": "./test/snapshot"
},
"nyc": {
"all": true,
Expand Down
2 changes: 1 addition & 1 deletion src/worker/task/build/deb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class BuildDeb extends Task {
* @return {void}
*/
protected async setup () {
const from = path.resolve(this.worker.workspace, 'clean')
const from = path.resolve(this.worker.workspace, 'dirty')

await fs.ensureDir(this.path)
await fs.copy(from, this.path)
Expand Down
7 changes: 2 additions & 5 deletions src/worker/task/debian/changelog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,13 @@ export class DebianChangelog extends Task {
}

/**
* Checks the Debian control file for errors
* Checks the Debian changelog file for errors
*
* @async
* @return {void}
*/
public async run () {
const exists = fs.pathExists(this.path)
if (exists === false) {
await this.fill()
}
await this.fill()

// TODO: Lint?
}
Expand Down
40 changes: 40 additions & 0 deletions test/e2e/worker/task/debian/changelog.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* houston/test/e2e/worker/task/debian/changelog.ts
* Tests that the changelog task works as needed
*/

import { test } from 'ava'

import { DebianChangelog } from '../../../../../src/worker/task/debian/changelog'

import { mock } from '../../../../utility/worker'

test('changelog renders correctly', async (t) => {
const worker = await mock({
changelog: [{
author: 'Blake Kostner',
changes: 'updated some fun things',
date: new Date(),
version: '0.0.1'
}, {
author: 'Blake Kostner',
changes: 'resion release',
date: new Date(),
version: '1.0.0'
}],
nameAppstream: 'com.github.elementary.houston.desktop',
nameDomain: 'com.github.elementary.houston'
})

worker.tasks.push(DebianChangelog)

await worker.setup()
await worker.run()

const changelog = await worker.readFile('dirty/debian/changelog')

await worker.teardown()

t.not(changelog.indexOf('resion release'), -1)
t.not(changelog.indexOf('updated some fun things'), -1)
})
10 changes: 10 additions & 0 deletions test/utility/worker/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,14 @@ export class TestWorker extends Worker {
return fs.copy(fullFrom, this.get(to), { overwrite: true })
}

/**
* Returns the string version a file file in the worker directory
*
* @async
* @param {string} p Path of file in worker workspace
* @return {string}
*/
public async readFile (p) {
return fs.readFile(this.get(p), 'utf8')
}
}

0 comments on commit eb43d9e

Please sign in to comment.