-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
11666cb
commit 9f46fc1
Showing
10 changed files
with
293 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { describe } from 'node:test'; | ||
import { expect, test } from '@jest/globals'; | ||
import { getCargoVersion, updateCargoContents } from './cargo'; | ||
import { inc, ReleaseType } from 'semver'; | ||
import {describe} from 'node:test'; | ||
import {expect, test} from '@jest/globals'; | ||
import {getCargoVersion, updateCargoContents} from './cargo'; | ||
import {inc, ReleaseType} from 'semver'; | ||
import * as fs from 'fs/promises'; | ||
import * as path from 'path'; | ||
|
||
// language=Toml | ||
const makeToml = ({ version }): string => ` | ||
const makeToml = ({version}): string => ` | ||
[package] | ||
authors = ["GoRules Team <[email protected]>"] | ||
description = "Business rules engine" | ||
|
@@ -21,7 +21,6 @@ const makeToml = ({ version }): string => ` | |
anyhow = { workspace = true } | ||
thiserror = { workspace = true } | ||
async-trait = { workspace = true } | ||
bincode = { workspace = true, optional = true } | ||
serde_json = { workspace = true, features = ["arbitrary_precision"] } | ||
serde = { version = "1", features = ["derive"] } | ||
serde_v8 = { version = "0.88.0" } | ||
|
@@ -35,21 +34,21 @@ const makeToml = ({ version }): string => ` | |
describe('GitHub Action', () => { | ||
test('Bumps package', () => { | ||
const version = '0.2.0'; | ||
const initialToml = makeToml({ version }); | ||
const initialToml = makeToml({version}); | ||
|
||
const releases: ReleaseType[] = ['major', 'minor', 'patch']; | ||
for (const release of releases) { | ||
const newVersion = inc(version, release); | ||
const expectedToml = makeToml({ version: newVersion }); | ||
const expectedToml = makeToml({version: newVersion}); | ||
|
||
expect(updateCargoContents(initialToml, { version: newVersion })).toEqual(expectedToml); | ||
expect(updateCargoContents(initialToml, {version: newVersion})).toEqual(expectedToml); | ||
} | ||
}); | ||
|
||
test('Extracts package version', () => { | ||
const versions = ['0.1.0', '0.2.0', '0.3.0']; | ||
for (const version of versions) { | ||
const versionedToml = makeToml({ version }); | ||
const versionedToml = makeToml({version}); | ||
expect(getCargoVersion(versionedToml)).toEqual(version); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.