import { describe, it, before } from "node:test" import assert from "node:assert" import { PlataModels } from ".." import { PlataGlobalRuntime } from "../libs/runtime" declare global { interface Brands { testeString: string testeModel: string testBrand: number[] } // Tipo A pode ser usado como o Tipo B ? type AssertType = R } describe('Brands', () => { const plataPromise = (async () => { const g = global as any g.Plata = new PlataGlobalRuntime() })() before(async () => { await plataPromise }) const modelTest = new PlataModels.ModelTemplate({ brandString: [ PlataModels.VarChar>(0) ], } as const, {}) type ResultTypes = // Pode ser usado como uma string, mas não pode usar uma string qualquer no lugar | AssertType | AssertType | AssertType, true> // DeepWritable não vai confundir a Brand com um objeto qualquer | AssertType }>, { value: Brand<'testBrand'> }, true> ; it('preserva a referência e valor em runtime e altera apenas o tipo', () => { const valor = [3] const brandArray = Plata.Brand('testBrand', valor) type ResultTest = | AssertType | AssertType | AssertType, true> | AssertType, false> ; assert.strictEqual(valor, brandArray) assert.notStrictEqual(valor, [3]) }) })