How to use the fast-check.fullUnicodeString function in fast-check

To help you get started, we’ve selected a few fast-check examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sindresorhus / query-string / test / properties.js View on Github external
import deepEqual from 'deep-equal';
import * as fastCheck from 'fast-check';
import test from 'ava';
import queryString from '..';

// Valid query parameters must follow:
// - key can be any unicode string (not empty)
// - value must be one of:
// --> any unicode string
// --> null
// --> array containing values defined above (at least two items)
const queryParamsArbitrary = fastCheck.dictionary(
	fastCheck.fullUnicodeString(1, 10),
	fastCheck.oneof(
		fastCheck.fullUnicodeString(),
		fastCheck.constant(null),
		fastCheck.array(fastCheck.oneof(fastCheck.fullUnicodeString(), fastCheck.constant(null)), 2, 10)
	)
);

const optionsArbitrary = fastCheck.record({
	arrayFormat: fastCheck.constantFrom('bracket', 'index', 'none'),
	strict: fastCheck.boolean(),
	encode: fastCheck.constant(true),
	sort: fastCheck.constant(false)
}, {withDeletedKeys: true});

test('should read correctly from stringified query params', t => {
	t.notThrows(() => {
		fastCheck.assert(
			fastCheck.property(
github eemeli / yaml / tests / properties.js View on Github external
test('parse stringified object', () => {
    const key = fc.fullUnicodeString()
    const values = [
      key,
      fc.lorem(1000, false), // words
      fc.lorem(100, true), // sentences
      fc.boolean(),
      fc.integer(),
      fc.double(),
      fc.constantFrom(null, Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY)
    ]
    const yamlArbitrary = fc.anything({ key: key, values: values })
    const optionsArbitrary = fc.record(
      {
        keepBlobsInJSON: fc.boolean(),
        keepCstNodes: fc.boolean(),
        keepNodeTypes: fc.boolean(),
        mapAsMap: fc.constant(false),
github sindresorhus / query-string / test / properties.js View on Github external
import deepEqual from 'deep-equal';
import * as fastCheck from 'fast-check';
import test from 'ava';
import queryString from '..';

// Valid query parameters must follow:
// - key can be any unicode string (not empty)
// - value must be one of:
// --> any unicode string
// --> null
// --> array containing values defined above (at least two items)
const queryParamsArbitrary = fastCheck.dictionary(
	fastCheck.fullUnicodeString(1, 10),
	fastCheck.oneof(
		fastCheck.fullUnicodeString(),
		fastCheck.constant(null),
		fastCheck.array(fastCheck.oneof(fastCheck.fullUnicodeString(), fastCheck.constant(null)), 2, 10)
	)
);

const optionsArbitrary = fastCheck.record({
	arrayFormat: fastCheck.constantFrom('bracket', 'index', 'none'),
	strict: fastCheck.boolean(),
	encode: fastCheck.constant(true),
	sort: fastCheck.constant(false)
}, {withDeletedKeys: true});

test('should read correctly from stringified query params', t => {
	t.notThrows(() => {
github dubzzz / fuzz-rest-api / test / fuzz.js View on Github external
it('/api/profile/:uid', async () =>
    await fc.assert(
      fc.asyncProperty(fc.fullUnicodeString(), async uid => {
        await throwIfHttpFailed(httpGet(server, `/api/profile/${encodeURIComponent(uid)}`));
      }),
      { timeout: 100 }
    ));
  it('/api/comment', async () =>