test: Improved test cases

releases/v3
Tycho Bokdam 2020-12-14 23:11:38 +01:00
parent 9925916d8e
commit 609a140e1f
No known key found for this signature in database
GPG Key ID: A0FAE77C8CDF33C7
5 changed files with 15 additions and 15 deletions

View File

@ -106,7 +106,7 @@ jobs:
ENV: 'dont-use-git' ENV: 'dont-use-git'
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
pre-commit: test/pre-commit.js pre-commit: './test-pre-commit.js'
skip-on-empty: 'false' skip-on-empty: 'false'
- run: test -f pre-commit.test.json || (echo should be here && exit 1) - run: test -f pre-commit.test.json || (echo should be here && exit 1)
@ -136,7 +136,7 @@ jobs:
ENV: 'dont-use-git' ENV: 'dont-use-git'
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
pre-changelog-generation: test/pre-changelog-generation.js pre-changelog-generation: './test-pre-changelog-generation.js'
version-file: './test-file.toml' version-file: './test-file.toml'
version-path: 'package.version' version-path: 'package.version'
@ -359,7 +359,7 @@ jobs:
ENV: 'dont-use-git' ENV: 'dont-use-git'
with: with:
github-token: ${{ secrets.github_token }} github-token: ${{ secrets.github_token }}
version-file: './test/test-file-empty.toml' version-file: './test-file-empty.toml'
version-path: 'package.version' version-path: 'package.version'
- name: Show file - name: Show file

View File

@ -3,4 +3,4 @@ title = "test"
# Comment # Comment
[package] [package]
name = "test file" name = "test file"
version = "0.1.0" version = "0.9.3"

View File

@ -1,5 +1,5 @@
package: package:
version: '0.1.0' version: '9.4.5'
# Comment # Comment
different: different:

View File

@ -1,11 +1,11 @@
const fs = require('fs') const fs = require('fs')
const t = require('assert') const assert = require('assert')
exports.preVersionGeneration = (version) => { exports.preVersionGeneration = (version) => {
const { GITHUB_WORKSPACE } = process.env const { GITHUB_WORKSPACE } = process.env
t.ok(GITHUB_WORKSPACE, 'GITHUB_WORKSPACE should not be empty') assert.ok(GITHUB_WORKSPACE, 'GITHUB_WORKSPACE should not be empty')
t.ok(version, 'version should not be empty') assert.ok(version, 'version should not be empty')
const newVersion = '1.0.100' const newVersion = '1.0.100'
@ -17,9 +17,9 @@ exports.preVersionGeneration = (version) => {
exports.preTagGeneration = (tag) => { exports.preTagGeneration = (tag) => {
const { GITHUB_WORKSPACE } = process.env const { GITHUB_WORKSPACE } = process.env
t.ok(GITHUB_WORKSPACE, 'GITHUB_WORKSPACE should not be empty') assert.ok(GITHUB_WORKSPACE, 'GITHUB_WORKSPACE should not be empty')
t.ok(tag, 'tag should not be empty') assert.ok(tag, 'tag should not be empty')
t.strictEqual(tag, 'v1.0.100') assert.strictEqual(tag, 'v1.0.100')
const newTag = 'v1.0.100-alpha' const newTag = 'v1.0.100-alpha'

View File

@ -1,12 +1,12 @@
const fs = require('fs') const fs = require('fs')
const t = require('assert') const assert = require('assert')
exports.preCommit = (props) => { exports.preCommit = (props) => {
const {GITHUB_WORKSPACE} = process.env; const {GITHUB_WORKSPACE} = process.env;
t.ok(GITHUB_WORKSPACE, 'GITHUB_WORKSPACE should not be empty') assert.ok(GITHUB_WORKSPACE, 'GITHUB_WORKSPACE should not be empty')
t.ok(props.tag, 'tag should not be empty') assert.ok(props.tag, 'tag should not be empty')
t.ok(props.version, 'version should not be empty') assert.ok(props.version, 'version should not be empty')
const body = { const body = {
workspace: GITHUB_WORKSPACE, workspace: GITHUB_WORKSPACE,