mirror of
https://github.com/Start9Labs/start-sdk.git
synced 2026-03-31 20:43:43 +00:00
feat: Remove aggregator in index for export
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { T } from ".."
|
||||
import { Effects } from "../types"
|
||||
import { utils } from "../util"
|
||||
|
||||
type WrapperType = {
|
||||
@@ -13,106 +13,101 @@ const noop = () => {}
|
||||
describe("wrapperData", () => {
|
||||
test("types", async () => {
|
||||
;async () => {
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData("/config", {
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData("/config", {
|
||||
someValue: "a",
|
||||
})
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData(
|
||||
"/config/someValue",
|
||||
"b",
|
||||
)
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData("", {
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData("", {
|
||||
config: { someValue: "b" },
|
||||
})
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData(
|
||||
"/config/someValue",
|
||||
|
||||
// @ts-expect-error Type is wrong for the setting value
|
||||
5,
|
||||
)
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData(
|
||||
// @ts-expect-error Path is wrong
|
||||
"/config/someVae3lue",
|
||||
"someValue",
|
||||
)
|
||||
|
||||
todo<T.Effects>().setWrapperData<WrapperType, "/config/someValue">({
|
||||
todo<Effects>().setWrapperData<WrapperType, "/config/someValue">({
|
||||
path: "/config/someValue",
|
||||
value: "b",
|
||||
})
|
||||
todo<T.Effects>().setWrapperData<WrapperType, "/config/some2Value">({
|
||||
todo<Effects>().setWrapperData<WrapperType, "/config/some2Value">({
|
||||
//@ts-expect-error Path is wrong
|
||||
path: "/config/someValue",
|
||||
//@ts-expect-error Path is wrong
|
||||
value: "someValueIn",
|
||||
})
|
||||
todo<T.Effects>().setWrapperData<WrapperType, "/config/someValue">({
|
||||
todo<Effects>().setWrapperData<WrapperType, "/config/someValue">({
|
||||
//@ts-expect-error Path is wrong
|
||||
path: "/config/some2Value",
|
||||
value: "a",
|
||||
})
|
||||
;(await utils<WrapperType, {}>(todo<T.Effects>())
|
||||
;(await utils<WrapperType, {}>(todo<Effects>())
|
||||
.getOwnWrapperData("/config/someValue")
|
||||
.const()) satisfies string
|
||||
;(await utils<WrapperType, {}>(todo<T.Effects>())
|
||||
;(await utils<WrapperType, {}>(todo<Effects>())
|
||||
.getOwnWrapperData("/config")
|
||||
.const()) satisfies WrapperType["config"]
|
||||
await utils<WrapperType, {}>(todo<T.Effects>())
|
||||
await utils<WrapperType, {}>(todo<Effects>())
|
||||
// @ts-expect-error Path is wrong
|
||||
.getOwnWrapperData("/config/somdsfeValue")
|
||||
.const()
|
||||
/// ----------------- ERRORS -----------------
|
||||
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData("", {
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData("", {
|
||||
// @ts-expect-error Type is wrong for the setting value
|
||||
config: { someValue: "notInAOrB" },
|
||||
})
|
||||
utils<WrapperType>(todo<T.Effects>()).setOwnWrapperData(
|
||||
utils<WrapperType>(todo<Effects>()).setOwnWrapperData(
|
||||
"/config/someValue",
|
||||
// @ts-expect-error Type is wrong for the setting value
|
||||
"notInAOrB",
|
||||
)
|
||||
;(await utils<WrapperType>(todo<T.Effects>())
|
||||
;(await utils<WrapperType>(todo<Effects>())
|
||||
.getOwnWrapperData("/config/someValue")
|
||||
// @ts-expect-error Const should normally not be callable
|
||||
.const()) satisfies string
|
||||
;(await utils<WrapperType>(todo<T.Effects>())
|
||||
;(await utils<WrapperType>(todo<Effects>())
|
||||
.getOwnWrapperData("/config")
|
||||
// @ts-expect-error Const should normally not be callable
|
||||
.const()) satisfies WrapperType["config"]
|
||||
await utils<WrapperType>(todo<T.Effects>())
|
||||
await utils<WrapperType>(todo<Effects>())
|
||||
// @ts-expect-error Path is wrong
|
||||
.getOwnWrapperData("/config/somdsfeValue")
|
||||
// @ts-expect-error Const should normally not be callable
|
||||
.const()
|
||||
|
||||
///
|
||||
;(await utils<WrapperType>(todo<T.Effects>())
|
||||
;(await utils<WrapperType>(todo<Effects>())
|
||||
.getOwnWrapperData("/config/someValue")
|
||||
// @ts-expect-error satisfies type is wrong
|
||||
.const()) satisfies number
|
||||
;(await utils<WrapperType, {}>(todo<T.Effects>())
|
||||
;(await utils<WrapperType, {}>(todo<Effects>())
|
||||
// @ts-expect-error Path is wrong
|
||||
.getOwnWrapperData("/config/")
|
||||
.const()) satisfies WrapperType["config"]
|
||||
;(await todo<T.Effects>().getWrapperData<
|
||||
WrapperType,
|
||||
"/config/someValue"
|
||||
>({
|
||||
;(await todo<Effects>().getWrapperData<WrapperType, "/config/someValue">({
|
||||
path: "/config/someValue",
|
||||
callback: noop,
|
||||
})) satisfies string
|
||||
await todo<T.Effects>().getWrapperData<WrapperType, "/config/someValue">({
|
||||
await todo<Effects>().getWrapperData<WrapperType, "/config/someValue">({
|
||||
// @ts-expect-error Path is wrong as in it doesn't match above
|
||||
path: "/config/someV2alue",
|
||||
callback: noop,
|
||||
})
|
||||
await todo<T.Effects>().getWrapperData<WrapperType, "/config/someV2alue">(
|
||||
{
|
||||
// @ts-expect-error Path is wrong as in it doesn't exists in wrapper type
|
||||
path: "/config/someV2alue",
|
||||
callback: noop,
|
||||
},
|
||||
)
|
||||
await todo<Effects>().getWrapperData<WrapperType, "/config/someV2alue">({
|
||||
// @ts-expect-error Path is wrong as in it doesn't exists in wrapper type
|
||||
path: "/config/someV2alue",
|
||||
callback: noop,
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user