- Status
- type-checked
- Industry
- Cross-industry
- Language
- TypeScript
- Framework
- Vitest
- CI
- any
- Fulfilment
- BUILD_DATASET
- Profile
- edge-cases-core
About this example
All data is synthetic. DataNivra provisions approved test data into a customer-controlled target; it does not run these tests. Credentials for the target are never returned by DataNivra — your runner holds its own.
Why test data matters
Length limits, collation and truncation break on multi-byte text.
What is requested
300 core boundary records (field-length and type boundaries).
Policy gates
Within the profile.
What is provisioned
A certified synthetic dataset.
Expected output
AUTO_APPROVED. Which scripts and alphabets appear depends on the generators of your estate; check them in a plan before relying on a specific script.
Cleanup
afterAll releases.
Files
request.yamlunicode.test.ts
Run
- A tenant administrator defines and a second person approves the profile (
datanivra test-data define ../../profiles/edge-cases-core.yaml --submit, thendatanivra policies approve). datanivra test-data validate request.yaml && datanivra test-data plan request.yaml- Run the example with
DATANIVRA_BASE_URLand a session or workload token.
Files
Exactly as they are in the examples repository. Every value is a synthetic placeholder; nothing here is a credential.
request.yaml
# yaml-language-server: $schema=../../../../packages/contracts/schemas/v1/manifests/test-data-request.schema.json
# DataNivra test-data-request manifest (apiVersion datanivra.io/v1alpha1). Validate: datanivra test-data validate <file>
apiVersion: datanivra.io/v1alpha1
kind: TestDataRequest
metadata:
name: unicode-boundaries
spec:
profile: { name: edge-cases-core, version: 1 }
scenarios:
- { scenario_code: CORE_BOUNDARY, count: 300 }
examples/test-data-api/scenarios/15-unicode-localization/request.yaml
unicode.test.ts
/**
* Unicode boundaries — Vitest suite that acquires approved test data before the tests and always releases it.
* DataNivra provisions data into the approved target; your tests use their own database access.
*/
import { readFileSync } from 'node:fs';
import type { TestDataRequest } from '@datanivra/contracts';
import { createDataNivraClient } from '@datanivra/sdk';
import { TestDataClient } from '@datanivra/sdk/testdata';
import { afterAll, beforeAll, describe, expect, it } from 'vitest';
const api = createDataNivraClient({
baseUrl: process.env.DATANIVRA_BASE_URL ?? 'https://api.example.test',
getAccessToken: () => process.env.DATANIVRA_TOKEN,
});
const testData = new TestDataClient(api);
let request: TestDataRequest | undefined;
beforeAll(async () => {
const manifest = readFileSync(new URL('./request.yaml', import.meta.url), 'utf8');
const created = await testData.request(manifest, { idempotencyKey: process.env.CI_RUN_KEY });
request = await testData.wait(created.id, { timeoutMs: 600_000 });
}, 660_000);
afterAll(async () => {
if (request) await testData.release(request.id, 'TEST_RUN_FINISHED');
});
describe('text handling', () => {
it('runs against approved, certified test data', () => {
expect(request?.state).toBe('READY');
// assert length limits and sorting on the generated text fields
});
});
examples/test-data-api/scenarios/15-unicode-localization/unicode.test.ts
The profile it uses: edge-cases-core
A tenant administrator defines this profile and a second person approves it; requests can only ask for what it allows. All profiles
edge-cases-core.yaml
# yaml-language-server: $schema=../../../packages/contracts/schemas/v1/manifests/test-data-profile.schema.json
# DataNivra test-data-profile manifest (apiVersion datanivra.io/v1alpha1). Validate: datanivra test-data validate <file>
# Placeholder ids (00000000-0000-4000-8000-0000000000NN): replace with your ids.
# 01 = approved target environment, 11 = certified dataset, 21 = customer agent,
# 99 = workload identity trust (datanivra workload-identities list).
apiVersion: datanivra.io/v1alpha1
kind: TestDataProfile
metadata:
name: edge-cases-core
description: Core synthetic edge cases (no industry pack)
spec:
fulfilment: BUILD_DATASET
build:
business_domain: generic records
dataset_kind: SYNTHETIC_ONLY
target_environment_id: 00000000-0000-4000-8000-000000000001
retention_days: 1
max_total_records: 50000
scenarios:
- { scenario_code: CORE_NORMAL, kind: NORMAL, default_count: 200, max_count: 1000 }
- { scenario_code: CORE_BOUNDARY, kind: BOUNDARY, default_count: 100, max_count: 500 }
- {
scenario_code: CORE_TEMPORAL_SEQUENCE,
kind: TEMPORAL_SEQUENCE,
default_count: 100,
max_count: 500,
included_by_default: false,
}
- {
scenario_code: CORE_NULL_HEAVY,
kind: NULL_HEAVY,
default_count: 50,
max_count: 200,
included_by_default: false,
}
- {
scenario_code: CORE_INVALID,
kind: INVALID,
default_count: 50,
max_count: 200,
included_by_default: false,
}
- {
scenario_code: CORE_DUPLICATE,
kind: DUPLICATE,
default_count: 50,
max_count: 200,
included_by_default: false,
}
- {
scenario_code: CORE_HIGH_VOLUME,
kind: HIGH_VOLUME,
default_count: 1000,
max_count: 50000,
included_by_default: false,
}