Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

alge

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alge - npm Package Compare versions

Comparing version 0.1.0-next.10 to 0.1.0-next.11

2

package.json
{
"name": "alge",
"version": "0.1.0-next.10",
"version": "0.1.0-next.11",
"repository": "git@github.com:jasonkuhrt/alge.git",

@@ -5,0 +5,0 @@ "author": "Jason Kuhrt",

@@ -39,14 +39,39 @@ import { Alge } from '.'

})
describe(`namespace api`, () => {
it(`The name of variant is statically known and available at runtime`, () => {
describe(`api`, () => {
it(`.symbol contains the unique symbol for this variant`, () => {
const A = Alge.create($A).variant($M, { a: z.string() }).variant($N, { a: z.string() }).done()
expectType<symbol>(A.M.symbol)
expect(typeof A.M.symbol).toBe(`symbol`)
})
it(`.name contains the name of the variant`, () => {
const A = Alge.create($A).variant($M, { a: z.string() }).variant($N, { a: z.string() }).done()
expectType<$M>(A.M.name)
expect(A.M.name).toBe($M)
expectType<$N>(A.N.name)
expect(A.N.name).toBe($N)
})
it(`The tag (symbol) of variant is statically known and available at runtime`, () => {
it(`.schema contains the zod schema for the variant`, () => {
const A = Alge.create($A).variant($M, { a: z.string() }).variant($N, { a: z.string() }).done()
expectType<symbol>(A.M.symbol)
expect(typeof A.M.symbol).toBe(`symbol`)
expectType<z.ZodSchema>(A.M.schema)
expect(A.M.schema).toBeDefined()
expect(A.M.schema.safeParse(``).success).toBe(false)
expectType<z.ZodSchema>(A.N.schema)
expect(A.N.schema).toBeDefined()
expect(A.N.schema.safeParse(``).success).toBe(false)
})
it(`.create() constructs data of that variant`, () => {
const A = Alge.create($A).variant($M, { m: z.string() }).variant($N, { n: z.number() }).done()
// @ts-expect-error: Invalid input
A.M.create({ x: 1 })
// @ts-expect-error: Input required
A.M.create()
// @ts-expect-error: Input required
A.M.create({ m: `m`, n: 2 })
expect(A.M.create({ m: `m` })).toEqual({ m: `m`, _tag: $M, _: { symbol: A.M.symbol } })
expect(A.N.create({ n: 1 })).toEqual({ n: 1, _tag: $N, _: { symbol: A.N.symbol } })
})
it(`.create()`, () => {

@@ -53,0 +78,0 @@ const A = Alge.create($A).variant($M, { a: z.string() }).variant($N, { a: z.string() }).done()

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc