Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { serializedDependency } from '../serialized-dependency';
import { $refArbitrary } from '../../../../../utils/__tests__/ref.spec';
import { getRelativePath } from '../../../../../utils/ref';
import { pipe } from 'fp-ts/lib/pipeable';
import { arbitrary, nonEmptyArray } from '../../../../../utils/fast-check';
import { none, some } from 'fp-ts/lib/Option';
import { getIOName, getTypeName, UNSAFE_PROPERTY_PATTERN } from '../../utils';
import { when } from '../../../../../utils/string';
import { head } from 'fp-ts/lib/NonEmptyArray';
const serializedDependencyArbitrary = tuple(string(), string()).map(([name, path]) => serializedDependency(name, path));
export const serializedTypeArbitrary = tuple(
string(),
string(),
array(serializedDependencyArbitrary),
pipe(array($refArbitrary)),
).map(([type, io, dependencies, refs]) => serializedType(type, io, dependencies, refs));
const name = oneof(string(), constant(undefined));
describe('SerializedType', () => {
it('getSerializedArrayType', () => {
assert(
property(serializedTypeArbitrary, name, (s, name) => {
expect(pipe(s, getSerializedArrayType(name))).toEqual(
serializedType(
`Array<${s.type}>`,
`array(${s.io}${when(name !== undefined, `, '${name}'`)})`,
[...s.dependencies, serializedDependency('array', 'io-ts')],
s.refs,
),
const listOfCharRange = (max = 40) => C.array(charRangeGen(), 1, max);
export function nonEmptyArray<a>(arb: fc.Arbitrary</a><a>): fc.Arbitrary> {
return fc.array(arb, 1, 100) as any
}
</a>
const fcUint8Array = (minLength: number, maxLength: number) =>
fc
.array(fc.integer(0, maxUint8Number), minLength, maxLength)
.map(a => Uint8Array.from(a));
const fcUint8Array = (minLength: number, maxLength: number) =>
fc
.array(fc.integer(0, 255), minLength, maxLength)
.map(a => Uint8Array.from(a));
const fcUint8Array32 = () => fcUint8Array(32, 32);
const fcUint8Array = (minLength: number, maxLength: number) =>
fc
.array(fc.integer(0, maxUint8Number), minLength, maxLength)
.map(a => Uint8Array.from(a));