mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-01 21:13:09 +00:00
add documentation for ai agents (#3115)
* add documentation for ai agents * docs: consolidate CLAUDE.md and CONTRIBUTING.md, add style guidelines - Refactor CLAUDE.md to reference CONTRIBUTING.md for build/test/format info - Expand CONTRIBUTING.md with comprehensive build targets, env vars, and testing - Add code style guidelines section with conventional commits - Standardize SDK prettier config to use single quotes (matching web) - Add project-level Claude Code settings to disable co-author attribution * style(sdk): apply prettier with single quotes Run prettier across sdk/base and sdk/package to apply the standardized quote style (single quotes matching web). * docs: add USER.md for per-developer TODO filtering - Add agents/USER.md to .gitignore (contains user identifier) - Document session startup flow in CLAUDE.md: - Create USER.md if missing, prompting for identifier - Filter TODOs by @username tags - Offer relevant TODOs on session start * docs: add i18n documentation task to agent TODOs * docs: document i18n ID patterns in core/ Add agents/i18n-patterns.md covering rust-i18n setup, translation file format, t!() macro usage, key naming conventions, and locale selection. Remove completed TODO item and add reference in CLAUDE.md. * chore: clarify that all builds work on any OS with Docker
This commit is contained in:
@@ -1,310 +1,310 @@
|
||||
import { VersionRange, ExtendedVersion } from "../exver"
|
||||
describe("ExVer", () => {
|
||||
import { VersionRange, ExtendedVersion } from '../exver'
|
||||
describe('ExVer', () => {
|
||||
{
|
||||
{
|
||||
const checker = VersionRange.parse("*")
|
||||
const checker = VersionRange.parse('*')
|
||||
test("VersionRange.parse('*')", () => {
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1:0"))
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.5"))
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.5.6"))
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1:0'))
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.5'))
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.5.6'))
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
test("VersionRange.parse('*') invalid", () => {
|
||||
expect(() => checker.satisfiedBy(ExtendedVersion.parse("a"))).toThrow()
|
||||
expect(() => checker.satisfiedBy(ExtendedVersion.parse(""))).toThrow()
|
||||
expect(() => checker.satisfiedBy(ExtendedVersion.parse('a'))).toThrow()
|
||||
expect(() => checker.satisfiedBy(ExtendedVersion.parse(''))).toThrow()
|
||||
expect(() =>
|
||||
checker.satisfiedBy(ExtendedVersion.parse("1..3")),
|
||||
checker.satisfiedBy(ExtendedVersion.parse('1..3')),
|
||||
).toThrow()
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const checker = VersionRange.parse(">1.2.3:4")
|
||||
const checker = VersionRange.parse('>1.2.3:4')
|
||||
test(`VersionRange.parse(">1.2.3:4") valid`, () => {
|
||||
expect(
|
||||
checker.satisfiedBy(ExtendedVersion.parse("2-beta.123:0")),
|
||||
checker.satisfiedBy(ExtendedVersion.parse('2-beta.123:0')),
|
||||
).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse(">1.2.3:4") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checker = VersionRange.parse("=1.2.3")
|
||||
const checker = VersionRange.parse('=1.2.3')
|
||||
test(`VersionRange.parse("=1.2.3") valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse("=1.2.3") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:1'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
// TODO: this this correct? if not, also fix normalize
|
||||
const checker = VersionRange.parse("=1")
|
||||
const checker = VersionRange.parse('=1')
|
||||
test(`VersionRange.parse("=1") valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.0.0:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.0.0:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse("=1") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.0.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.0.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.0.0:1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.0.0:1'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checker = VersionRange.parse(">=1.2.3:4")
|
||||
const checker = VersionRange.parse('>=1.2.3:4')
|
||||
test(`VersionRange.parse(">=1.2.3:4") valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse(">=1.2.3:4") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checker = VersionRange.parse("<1.2.3:4")
|
||||
const checker = VersionRange.parse('<1.2.3:4')
|
||||
test(`VersionRange.parse("<1.2.3:4") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse("<1.2.3:4") valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checker = VersionRange.parse("<=1.2.3:4")
|
||||
const checker = VersionRange.parse('<=1.2.3:4')
|
||||
test(`VersionRange.parse("<=1.2.3:4") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse("<=1.2.3:4") valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const checkA = VersionRange.parse(">1")
|
||||
const checkB = VersionRange.parse("<=2")
|
||||
const checkA = VersionRange.parse('>1')
|
||||
const checkB = VersionRange.parse('<=2')
|
||||
|
||||
const checker = checkA.and(checkB)
|
||||
test(`simple and(checkers) valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
test(`simple and(checkers) invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checkA = VersionRange.parse("<1")
|
||||
const checkB = VersionRange.parse("=2")
|
||||
const checkA = VersionRange.parse('<1')
|
||||
const checkB = VersionRange.parse('=2')
|
||||
|
||||
const checker = checkA.or(checkB)
|
||||
test(`simple or(checkers) valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("0.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('0.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
test(`simple or(checkers) invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const checker = VersionRange.parse("~1.2")
|
||||
const checker = VersionRange.parse('~1.2')
|
||||
test(`VersionRange.parse(~1.2) valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
})
|
||||
test(`VersionRange.parse(~1.2) invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.3:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.3.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.3.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false)
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const checker = VersionRange.parse("~1.2").not()
|
||||
const checker = VersionRange.parse('~1.2').not()
|
||||
test(`VersionRange.parse(~1.2).not() valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.3:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.3.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.3.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
})
|
||||
test(`VersionRange.parse(~1.2).not() invalid `, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checker = VersionRange.parse("!~1.2")
|
||||
const checker = VersionRange.parse('!~1.2')
|
||||
test(`!(VersionRange.parse(~1.2)) valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.3:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.3.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.3.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
})
|
||||
test(`!(VersionRange.parse(~1.2)) invalid `, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
}
|
||||
{
|
||||
const checker = VersionRange.parse("!>1.2.3:4")
|
||||
const checker = VersionRange.parse('!>1.2.3:4')
|
||||
test(`VersionRange.parse("!>1.2.3:4") invalid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:5"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:5'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4.1"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4.1'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
|
||||
test(`VersionRange.parse("!>1.2.3:4") valid`, () => {
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:4"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:4'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -316,103 +316,103 @@ describe("ExVer", () => {
|
||||
})
|
||||
}
|
||||
|
||||
testNormalization("=2.0", "=2.0:0")
|
||||
testNormalization("=1 && =2", "!")
|
||||
testNormalization("!(=1 && =2)", "*")
|
||||
testNormalization("!=1 || !=2", "*")
|
||||
testNormalization("(!=#foo:1 || !=#foo:2) && #foo", "#foo")
|
||||
testNormalization('=2.0', '=2.0:0')
|
||||
testNormalization('=1 && =2', '!')
|
||||
testNormalization('!(=1 && =2)', '*')
|
||||
testNormalization('!=1 || !=2', '*')
|
||||
testNormalization('(!=#foo:1 || !=#foo:2) && #foo', '#foo')
|
||||
testNormalization(
|
||||
"!=#foo:1 || !=#bar:2",
|
||||
"<#foo:1:0 || >#foo:1:0 || !#foo || <#bar:2:0 || >#bar:2:0 || !#bar",
|
||||
'!=#foo:1 || !=#bar:2',
|
||||
'<#foo:1:0 || >#foo:1:0 || !#foo || <#bar:2:0 || >#bar:2:0 || !#bar',
|
||||
)
|
||||
testNormalization("!(=1 || =2)", "<1:0 || (>1:0 && <2:0) || >2:0 || !#")
|
||||
testNormalization("=1 && (=2 || =3)", "!")
|
||||
testNormalization("=1 && (=1 || =2)", "=1:0")
|
||||
testNormalization("=#foo:1 && =#bar:1", "!")
|
||||
testNormalization('!(=1 || =2)', '<1:0 || (>1:0 && <2:0) || >2:0 || !#')
|
||||
testNormalization('=1 && (=2 || =3)', '!')
|
||||
testNormalization('=1 && (=1 || =2)', '=1:0')
|
||||
testNormalization('=#foo:1 && =#bar:1', '!')
|
||||
testNormalization(
|
||||
"!(=#foo:1) && !(=#bar:1)",
|
||||
"<#foo:1:0 || >#foo:1:0 || <#bar:1:0 || >#bar:1:0 || (!#foo && !#bar)",
|
||||
'!(=#foo:1) && !(=#bar:1)',
|
||||
'<#foo:1:0 || >#foo:1:0 || <#bar:1:0 || >#bar:1:0 || (!#foo && !#bar)',
|
||||
)
|
||||
testNormalization("!(=#foo:1) && !(=#bar:1) && >2", ">2:0")
|
||||
testNormalization("~1.2.3", ">=1.2.3:0 && <1.3.0:0")
|
||||
testNormalization("^1.2.3", ">=1.2.3:0 && <2.0.0:0")
|
||||
testNormalization('!(=#foo:1) && !(=#bar:1) && >2', '>2:0')
|
||||
testNormalization('~1.2.3', '>=1.2.3:0 && <1.3.0:0')
|
||||
testNormalization('^1.2.3', '>=1.2.3:0 && <2.0.0:0')
|
||||
testNormalization(
|
||||
"^1.2.3 && >=1 && >=1.2 && >=1.3",
|
||||
">=1.3:0 && <2.0.0:0",
|
||||
'^1.2.3 && >=1 && >=1.2 && >=1.3',
|
||||
'>=1.3:0 && <2.0.0:0',
|
||||
)
|
||||
testNormalization(
|
||||
"(>=1.0 && <1.1) || (>=1.1 && <1.2) || (>=1.2 && <1.3)",
|
||||
">=1.0:0 && <1.3:0",
|
||||
'(>=1.0 && <1.1) || (>=1.1 && <1.2) || (>=1.2 && <1.3)',
|
||||
'>=1.0:0 && <1.3:0',
|
||||
)
|
||||
testNormalization(">1 || <2", "#")
|
||||
testNormalization('>1 || <2', '#')
|
||||
|
||||
testNormalization("=1 && =1.2 && =1.2.3", "!")
|
||||
testNormalization('=1 && =1.2 && =1.2.3', '!')
|
||||
// testNormalization("=1 && =1.2 && =1.2.3", "=1.2.3:0"); TODO: should it be this instead?
|
||||
testNormalization("=1 || =1.2 || =1.2.3", "=1:0 || =1.2:0 || =1.2.3:0")
|
||||
testNormalization('=1 || =1.2 || =1.2.3', '=1:0 || =1.2:0 || =1.2.3:0')
|
||||
// testNormalization("=1 || =1.2 || =1.2.3", "=1:0"); TODO: should it be this instead?
|
||||
}
|
||||
|
||||
{
|
||||
test(">1 && =1.2", () => {
|
||||
const checker = VersionRange.parse(">1 && =1.2")
|
||||
test('>1 && =1.2', () => {
|
||||
const checker = VersionRange.parse('>1 && =1.2')
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.1:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.1:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
})
|
||||
test("=1 || =2", () => {
|
||||
const checker = VersionRange.parse("=1 || =2")
|
||||
test('=1 || =2', () => {
|
||||
const checker = VersionRange.parse('=1 || =2')
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
false,
|
||||
) // really?
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2.3:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2.3:0'))).toEqual(
|
||||
false,
|
||||
) // really?
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("3:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('3:0'))).toEqual(false)
|
||||
})
|
||||
|
||||
test(">1 && =1.2 || =2", () => {
|
||||
const checker = VersionRange.parse(">1 && =1.2 || =2")
|
||||
test('>1 && =1.2 || =2', () => {
|
||||
const checker = VersionRange.parse('>1 && =1.2 || =2')
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.2:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.2:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("3:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('3:0'))).toEqual(false)
|
||||
})
|
||||
|
||||
test("&& before || order of operationns: <1.5 && >1 || >1.5 && <3", () => {
|
||||
const checker = VersionRange.parse("<1.5 && >1 || >1.5 && <3")
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.1:0"))).toEqual(
|
||||
test('&& before || order of operationns: <1.5 && >1 || >1.5 && <3', () => {
|
||||
const checker = VersionRange.parse('<1.5 && >1 || >1.5 && <3')
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.1:0'))).toEqual(
|
||||
true,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("2:0"))).toEqual(true)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('2:0'))).toEqual(true)
|
||||
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1.5:0"))).toEqual(
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1.5:0'))).toEqual(
|
||||
false,
|
||||
)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("1:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse("3:0"))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('1:0'))).toEqual(false)
|
||||
expect(checker.satisfiedBy(ExtendedVersion.parse('3:0'))).toEqual(false)
|
||||
})
|
||||
|
||||
test("Compare function on the emver", () => {
|
||||
const a = ExtendedVersion.parse("1.2.3:0")
|
||||
const b = ExtendedVersion.parse("1.2.4:0")
|
||||
test('Compare function on the emver', () => {
|
||||
const a = ExtendedVersion.parse('1.2.3:0')
|
||||
const b = ExtendedVersion.parse('1.2.4:0')
|
||||
|
||||
expect(a.compare(b)).toEqual("less")
|
||||
expect(b.compare(a)).toEqual("greater")
|
||||
expect(a.compare(a)).toEqual("equal")
|
||||
expect(a.compare(b)).toEqual('less')
|
||||
expect(b.compare(a)).toEqual('greater')
|
||||
expect(a.compare(a)).toEqual('equal')
|
||||
})
|
||||
test("Compare for sort function on the emver", () => {
|
||||
const a = ExtendedVersion.parse("1.2.3:0")
|
||||
const b = ExtendedVersion.parse("1.2.4:0")
|
||||
test('Compare for sort function on the emver', () => {
|
||||
const a = ExtendedVersion.parse('1.2.3:0')
|
||||
const b = ExtendedVersion.parse('1.2.4:0')
|
||||
|
||||
expect(a.compareForSort(b)).toEqual(-1)
|
||||
expect(b.compareForSort(a)).toEqual(1)
|
||||
|
||||
@@ -1,110 +1,110 @@
|
||||
import { Graph } from "../util"
|
||||
import { Graph } from '../util'
|
||||
|
||||
describe("graph", () => {
|
||||
describe('graph', () => {
|
||||
{
|
||||
{
|
||||
test("findVertex", () => {
|
||||
test('findVertex', () => {
|
||||
const graph = new Graph<string, string>()
|
||||
const foo = graph.addVertex("foo", [], [])
|
||||
const foo = graph.addVertex('foo', [], [])
|
||||
const bar = graph.addVertex(
|
||||
"bar",
|
||||
[{ from: foo, metadata: "foo-bar" }],
|
||||
'bar',
|
||||
[{ from: foo, metadata: 'foo-bar' }],
|
||||
[],
|
||||
)
|
||||
const baz = graph.addVertex(
|
||||
"baz",
|
||||
[{ from: bar, metadata: "bar-baz" }],
|
||||
'baz',
|
||||
[{ from: bar, metadata: 'bar-baz' }],
|
||||
[],
|
||||
)
|
||||
const qux = graph.addVertex(
|
||||
"qux",
|
||||
[{ from: baz, metadata: "baz-qux" }],
|
||||
'qux',
|
||||
[{ from: baz, metadata: 'baz-qux' }],
|
||||
[],
|
||||
)
|
||||
const match = Array.from(graph.findVertex((v) => v.metadata === "qux"))
|
||||
const match = Array.from(graph.findVertex((v) => v.metadata === 'qux'))
|
||||
expect(match).toHaveLength(1)
|
||||
expect(match[0]).toBe(qux)
|
||||
})
|
||||
test("shortestPathA", () => {
|
||||
test('shortestPathA', () => {
|
||||
const graph = new Graph<string, string>()
|
||||
const foo = graph.addVertex("foo", [], [])
|
||||
const foo = graph.addVertex('foo', [], [])
|
||||
const bar = graph.addVertex(
|
||||
"bar",
|
||||
[{ from: foo, metadata: "foo-bar" }],
|
||||
'bar',
|
||||
[{ from: foo, metadata: 'foo-bar' }],
|
||||
[],
|
||||
)
|
||||
const baz = graph.addVertex(
|
||||
"baz",
|
||||
[{ from: bar, metadata: "bar-baz" }],
|
||||
'baz',
|
||||
[{ from: bar, metadata: 'bar-baz' }],
|
||||
[],
|
||||
)
|
||||
const qux = graph.addVertex(
|
||||
"qux",
|
||||
[{ from: baz, metadata: "baz-qux" }],
|
||||
'qux',
|
||||
[{ from: baz, metadata: 'baz-qux' }],
|
||||
[],
|
||||
)
|
||||
graph.addEdge("foo-qux", foo, qux)
|
||||
graph.addEdge('foo-qux', foo, qux)
|
||||
expect(graph.shortestPath(foo, qux) || []).toHaveLength(1)
|
||||
})
|
||||
test("shortestPathB", () => {
|
||||
test('shortestPathB', () => {
|
||||
const graph = new Graph<string, string>()
|
||||
const foo = graph.addVertex("foo", [], [])
|
||||
const foo = graph.addVertex('foo', [], [])
|
||||
const bar = graph.addVertex(
|
||||
"bar",
|
||||
[{ from: foo, metadata: "foo-bar" }],
|
||||
'bar',
|
||||
[{ from: foo, metadata: 'foo-bar' }],
|
||||
[],
|
||||
)
|
||||
const baz = graph.addVertex(
|
||||
"baz",
|
||||
[{ from: bar, metadata: "bar-baz" }],
|
||||
'baz',
|
||||
[{ from: bar, metadata: 'bar-baz' }],
|
||||
[],
|
||||
)
|
||||
const qux = graph.addVertex(
|
||||
"qux",
|
||||
[{ from: baz, metadata: "baz-qux" }],
|
||||
'qux',
|
||||
[{ from: baz, metadata: 'baz-qux' }],
|
||||
[],
|
||||
)
|
||||
graph.addEdge("bar-qux", bar, qux)
|
||||
graph.addEdge('bar-qux', bar, qux)
|
||||
expect(graph.shortestPath(foo, qux) || []).toHaveLength(2)
|
||||
})
|
||||
test("shortestPathC", () => {
|
||||
test('shortestPathC', () => {
|
||||
const graph = new Graph<string, string>()
|
||||
const foo = graph.addVertex("foo", [], [])
|
||||
const foo = graph.addVertex('foo', [], [])
|
||||
const bar = graph.addVertex(
|
||||
"bar",
|
||||
[{ from: foo, metadata: "foo-bar" }],
|
||||
'bar',
|
||||
[{ from: foo, metadata: 'foo-bar' }],
|
||||
[],
|
||||
)
|
||||
const baz = graph.addVertex(
|
||||
"baz",
|
||||
[{ from: bar, metadata: "bar-baz" }],
|
||||
'baz',
|
||||
[{ from: bar, metadata: 'bar-baz' }],
|
||||
[],
|
||||
)
|
||||
const qux = graph.addVertex(
|
||||
"qux",
|
||||
[{ from: baz, metadata: "baz-qux" }],
|
||||
[{ to: foo, metadata: "qux-foo" }],
|
||||
'qux',
|
||||
[{ from: baz, metadata: 'baz-qux' }],
|
||||
[{ to: foo, metadata: 'qux-foo' }],
|
||||
)
|
||||
expect(graph.shortestPath(foo, qux) || []).toHaveLength(3)
|
||||
})
|
||||
test("bfs", () => {
|
||||
test('bfs', () => {
|
||||
const graph = new Graph<string, string>()
|
||||
const foo = graph.addVertex("foo", [], [])
|
||||
const foo = graph.addVertex('foo', [], [])
|
||||
const bar = graph.addVertex(
|
||||
"bar",
|
||||
[{ from: foo, metadata: "foo-bar" }],
|
||||
'bar',
|
||||
[{ from: foo, metadata: 'foo-bar' }],
|
||||
[],
|
||||
)
|
||||
const baz = graph.addVertex(
|
||||
"baz",
|
||||
[{ from: bar, metadata: "bar-baz" }],
|
||||
'baz',
|
||||
[{ from: bar, metadata: 'bar-baz' }],
|
||||
[],
|
||||
)
|
||||
const qux = graph.addVertex(
|
||||
"qux",
|
||||
'qux',
|
||||
[
|
||||
{ from: foo, metadata: "foo-qux" },
|
||||
{ from: baz, metadata: "baz-qux" },
|
||||
{ from: foo, metadata: 'foo-qux' },
|
||||
{ from: baz, metadata: 'baz-qux' },
|
||||
],
|
||||
[],
|
||||
)
|
||||
@@ -115,24 +115,24 @@ describe("graph", () => {
|
||||
expect(bfs[2]).toBe(qux)
|
||||
expect(bfs[3]).toBe(baz)
|
||||
})
|
||||
test("reverseBfs", () => {
|
||||
test('reverseBfs', () => {
|
||||
const graph = new Graph<string, string>()
|
||||
const foo = graph.addVertex("foo", [], [])
|
||||
const foo = graph.addVertex('foo', [], [])
|
||||
const bar = graph.addVertex(
|
||||
"bar",
|
||||
[{ from: foo, metadata: "foo-bar" }],
|
||||
'bar',
|
||||
[{ from: foo, metadata: 'foo-bar' }],
|
||||
[],
|
||||
)
|
||||
const baz = graph.addVertex(
|
||||
"baz",
|
||||
[{ from: bar, metadata: "bar-baz" }],
|
||||
'baz',
|
||||
[{ from: bar, metadata: 'bar-baz' }],
|
||||
[],
|
||||
)
|
||||
const qux = graph.addVertex(
|
||||
"qux",
|
||||
'qux',
|
||||
[
|
||||
{ from: foo, metadata: "foo-qux" },
|
||||
{ from: baz, metadata: "baz-qux" },
|
||||
{ from: foo, metadata: 'foo-qux' },
|
||||
{ from: baz, metadata: 'baz-qux' },
|
||||
],
|
||||
[],
|
||||
)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import {
|
||||
ListValueSpecOf,
|
||||
isValueSpecListOf,
|
||||
} from "../actions/input/inputSpecTypes"
|
||||
import { InputSpec } from "../actions/input/builder/inputSpec"
|
||||
import { List } from "../actions/input/builder/list"
|
||||
import { Value } from "../actions/input/builder/value"
|
||||
} from '../actions/input/inputSpecTypes'
|
||||
import { InputSpec } from '../actions/input/builder/inputSpec'
|
||||
import { List } from '../actions/input/builder/list'
|
||||
import { Value } from '../actions/input/builder/value'
|
||||
|
||||
describe("InputSpec Types", () => {
|
||||
test("isValueSpecListOf", async () => {
|
||||
describe('InputSpec Types', () => {
|
||||
test('isValueSpecListOf', async () => {
|
||||
const options = [List.obj, List.text]
|
||||
for (const option of options) {
|
||||
const test = (option as any)(
|
||||
@@ -15,13 +15,13 @@ describe("InputSpec Types", () => {
|
||||
{ spec: InputSpec.of({}) } as any,
|
||||
) as any
|
||||
const someList = await Value.list(test).build({} as any)
|
||||
if (isValueSpecListOf(someList.spec, "text")) {
|
||||
someList.spec.spec satisfies ListValueSpecOf<"text">
|
||||
} else if (isValueSpecListOf(someList.spec, "object")) {
|
||||
someList.spec.spec satisfies ListValueSpecOf<"object">
|
||||
if (isValueSpecListOf(someList.spec, 'text')) {
|
||||
someList.spec.spec satisfies ListValueSpecOf<'text'>
|
||||
} else if (isValueSpecListOf(someList.spec, 'object')) {
|
||||
someList.spec.spec satisfies ListValueSpecOf<'object'>
|
||||
} else {
|
||||
throw new Error(
|
||||
"Failed to figure out the type: " + JSON.stringify(someList),
|
||||
'Failed to figure out the type: ' + JSON.stringify(someList),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Effects } from "../types"
|
||||
import { Effects } from '../types'
|
||||
import {
|
||||
CheckDependenciesParam,
|
||||
ClearTasksParams,
|
||||
@@ -14,27 +14,27 @@ import {
|
||||
SetDataVersionParams,
|
||||
SetMainStatus,
|
||||
GetServiceManifestParams,
|
||||
} from ".././osBindings"
|
||||
import { CreateSubcontainerFsParams } from ".././osBindings"
|
||||
import { DestroySubcontainerFsParams } from ".././osBindings"
|
||||
import { BindParams } from ".././osBindings"
|
||||
import { GetHostInfoParams } from ".././osBindings"
|
||||
import { SetHealth } from ".././osBindings"
|
||||
import { GetSslCertificateParams } from ".././osBindings"
|
||||
import { GetSslKeyParams } from ".././osBindings"
|
||||
import { GetServiceInterfaceParams } from ".././osBindings"
|
||||
import { SetDependenciesParams } from ".././osBindings"
|
||||
import { GetSystemSmtpParams } from ".././osBindings"
|
||||
import { GetServicePortForwardParams } from ".././osBindings"
|
||||
import { ExportServiceInterfaceParams } from ".././osBindings"
|
||||
import { ListServiceInterfacesParams } from ".././osBindings"
|
||||
import { ExportActionParams } from ".././osBindings"
|
||||
import { MountParams } from ".././osBindings"
|
||||
import { StringObject } from "../util"
|
||||
import { ExtendedVersion, VersionRange } from "../exver"
|
||||
} from '.././osBindings'
|
||||
import { CreateSubcontainerFsParams } from '.././osBindings'
|
||||
import { DestroySubcontainerFsParams } from '.././osBindings'
|
||||
import { BindParams } from '.././osBindings'
|
||||
import { GetHostInfoParams } from '.././osBindings'
|
||||
import { SetHealth } from '.././osBindings'
|
||||
import { GetSslCertificateParams } from '.././osBindings'
|
||||
import { GetSslKeyParams } from '.././osBindings'
|
||||
import { GetServiceInterfaceParams } from '.././osBindings'
|
||||
import { SetDependenciesParams } from '.././osBindings'
|
||||
import { GetSystemSmtpParams } from '.././osBindings'
|
||||
import { GetServicePortForwardParams } from '.././osBindings'
|
||||
import { ExportServiceInterfaceParams } from '.././osBindings'
|
||||
import { ListServiceInterfacesParams } from '.././osBindings'
|
||||
import { ExportActionParams } from '.././osBindings'
|
||||
import { MountParams } from '.././osBindings'
|
||||
import { StringObject } from '../util'
|
||||
import { ExtendedVersion, VersionRange } from '../exver'
|
||||
function typeEquality<ExpectedType>(_a: ExpectedType) {}
|
||||
|
||||
type WithCallback<T> = Omit<T, "callback"> & { callback: () => void }
|
||||
type WithCallback<T> = Omit<T, 'callback'> & { callback: () => void }
|
||||
|
||||
type EffectsTypeChecker<T extends StringObject = Effects> = {
|
||||
[K in keyof T]: T[K] extends (args: infer A) => any
|
||||
@@ -44,11 +44,11 @@ type EffectsTypeChecker<T extends StringObject = Effects> = {
|
||||
: never
|
||||
}
|
||||
|
||||
describe("startosTypeValidation ", () => {
|
||||
describe('startosTypeValidation ', () => {
|
||||
test(`checking the params match`, () => {
|
||||
typeEquality<EffectsTypeChecker>({
|
||||
eventId: {} as never,
|
||||
child: "",
|
||||
child: '',
|
||||
isInContext: {} as never,
|
||||
onLeaveContext: () => {},
|
||||
clearCallbacks: {} as ClearCallbacksParams,
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
import { deepEqual } from "../util"
|
||||
import { deepMerge } from "../util"
|
||||
import { deepEqual } from '../util'
|
||||
import { deepMerge } from '../util'
|
||||
|
||||
describe("deepMerge", () => {
|
||||
test("deepMerge({}, {a: 1}, {b: 2}) should return {a: 1, b: 2}", () => {
|
||||
describe('deepMerge', () => {
|
||||
test('deepMerge({}, {a: 1}, {b: 2}) should return {a: 1, b: 2}', () => {
|
||||
expect(deepMerge({}, { a: 1 }, { b: 2 })).toEqual({ a: 1, b: 2 })
|
||||
})
|
||||
test("deepMerge(null, [1,2,3]) should equal [1,2,3]", () => {
|
||||
test('deepMerge(null, [1,2,3]) should equal [1,2,3]', () => {
|
||||
expect(deepMerge(null, [1, 2, 3])).toEqual([1, 2, 3])
|
||||
})
|
||||
test("deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}}", () => {
|
||||
test('deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}}', () => {
|
||||
expect(deepMerge({ a: { b: 1, c: 2 } }, { a: { b: 3 } })).toEqual({
|
||||
a: { b: 3, c: 2 },
|
||||
})
|
||||
})
|
||||
test("deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}} with deep equal", () => {
|
||||
test('deepMerge({a: {b: 1, c:2}}, {a: {b: 3}}) should equal {a: {b: 3, c: 2}} with deep equal', () => {
|
||||
expect(
|
||||
deepEqual(deepMerge({ a: { b: 1, c: 2 } }, { a: { b: 3 } }), {
|
||||
a: { b: 3, c: 2 },
|
||||
}),
|
||||
).toBeTruthy()
|
||||
})
|
||||
test("Test that merging lists has Set semantics", () => {
|
||||
const merge = deepMerge(["a", "b"], ["b", "c"])
|
||||
test('Test that merging lists has Set semantics', () => {
|
||||
const merge = deepMerge(['a', 'b'], ['b', 'c'])
|
||||
expect(merge).toHaveLength(3)
|
||||
expect(merge).toContain("a")
|
||||
expect(merge).toContain("b")
|
||||
expect(merge).toContain("c")
|
||||
expect(merge).toContain('a')
|
||||
expect(merge).toContain('b')
|
||||
expect(merge).toContain('c')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { getHostname } from "../util/getServiceInterface"
|
||||
import { getHostname } from '../util/getServiceInterface'
|
||||
|
||||
describe("getHostname ", () => {
|
||||
describe('getHostname ', () => {
|
||||
const inputToExpected = [
|
||||
["http://localhost:3000", "localhost"],
|
||||
["http://localhost", "localhost"],
|
||||
["localhost", "localhost"],
|
||||
["http://127.0.0.1/", "127.0.0.1"],
|
||||
["http://127.0.0.1/testing/1234?314345", "127.0.0.1"],
|
||||
["127.0.0.1/", "127.0.0.1"],
|
||||
["http://mail.google.com/", "mail.google.com"],
|
||||
["mail.google.com/", "mail.google.com"],
|
||||
['http://localhost:3000', 'localhost'],
|
||||
['http://localhost', 'localhost'],
|
||||
['localhost', 'localhost'],
|
||||
['http://127.0.0.1/', '127.0.0.1'],
|
||||
['http://127.0.0.1/testing/1234?314345', '127.0.0.1'],
|
||||
['127.0.0.1/', '127.0.0.1'],
|
||||
['http://mail.google.com/', 'mail.google.com'],
|
||||
['mail.google.com/', 'mail.google.com'],
|
||||
]
|
||||
|
||||
for (const [input, expectValue] of inputToExpected) {
|
||||
|
||||
Reference in New Issue
Block a user