Skip to content

Commit

Permalink
Update test script, export getGitDiff, and add unit test for it in te…
Browse files Browse the repository at this point in the history
…st.js.
  • Loading branch information
zackbraksa committed Oct 10, 2024
1 parent f758a73 commit 9d50a67
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"gitai": "./bin/gitai.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "node --test",
"lint": "standard --fix 'src/*.js'",
"version": "git add -A",
"prerelease": "npm run lint",
Expand Down
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ program
})

program.parse()

module.exports = { getGitDiff }
10 changes: 10 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const assert = require('node:assert')
const test = require('node:test')
const { getGitDiff } = require('../src/index.js')

test('getGitDiff', async (t) => {
await t.test('should return a string', () => {
const diff = getGitDiff()
assert.strictEqual(typeof diff, 'string')
})
})

0 comments on commit 9d50a67

Please sign in to comment.