@@ -6,10 +6,10 @@ const path = require('node:path');
66const { test } = require ( 'node:test' ) ;
77const pkg = process . env . BREG_CLIENT_PACKAGE
88 ? require ( process . env . BREG_CLIENT_PACKAGE ) . breg : require ( '..' ) ;
9- const { BaseRegistryClient, occurrenceView } = pkg ;
9+ const { BaseRegistryClient, eventRecordView } = pkg ;
1010
1111const fixtures = path . join (
12- __dirname , '..' , '..' , 'registry-breg-client' , 'tests' , 'fixtures' , 'occurrence -view' ,
12+ __dirname , '..' , '..' , 'registry-breg-client' , 'tests' , 'fixtures' , 'event-record -view' ,
1313) ;
1414const read = ( name ) => fs . readFileSync ( path . join ( fixtures , name ) , 'utf8' ) ;
1515
@@ -19,31 +19,31 @@ const recordId = '6f1e0c62-0000-4000-8000-000000000001';
1919const hiddenId = '6f1e0c62-0000-4000-8000-000000000404' ;
2020const link = '<https://id.registrystack.org/profiles/registry-record/v1>; rel="profile", </v1/schemas/incorporation>; rel="describedby"' ;
2121
22- test ( 'occurrenceView projects every generated fixture to its recorded view' , ( ) => {
22+ test ( 'eventRecordView projects every generated fixture to its recorded view' , ( ) => {
2323 for ( const name of [
2424 'incorporation' , 'suspension-decision' , 'suspension-correction' , 'ownership-transfer' ,
2525 ] ) {
26- const view = occurrenceView ( read ( `${ name } .input.json` ) ) ;
26+ const view = eventRecordView ( read ( `${ name } .input.json` ) ) ;
2727 assert . equal ( typeof view , 'string' ) ;
2828 assert . deepEqual ( JSON . parse ( view ) , JSON . parse ( read ( `${ name } .json` ) ) , name ) ;
2929 }
3030} ) ;
3131
32- test ( 'occurrenceView raises a described occurrence failure' , ( ) => {
32+ test ( 'eventRecordView raises a described event record failure' , ( ) => {
3333 const input = JSON . parse ( read ( 'incorporation.input.json' ) ) ;
3434 input . descriptor . descriptorVersion = 2 ;
35- assert . throws ( ( ) => occurrenceView ( JSON . stringify ( input ) ) , ( error ) => {
36- assert . equal ( error . kind , 'occurrence ' ) ;
35+ assert . throws ( ( ) => eventRecordView ( JSON . stringify ( input ) ) , ( error ) => {
36+ assert . equal ( error . kind , 'event-record ' ) ;
3737 assert . equal ( error . code , 'unsupported-version' ) ;
3838 assert . equal ( error . outcomeUnknown , false ) ;
3939 return true ;
4040 } ) ;
41- assert . throws ( ( ) => occurrenceView ( '{"unknown":true}' ) , ( error ) => {
42- assert . equal ( error . kind , 'occurrence ' ) ;
41+ assert . throws ( ( ) => eventRecordView ( '{"unknown":true}' ) , ( error ) => {
42+ assert . equal ( error . kind , 'event-record ' ) ;
4343 assert . equal ( error . code , 'invalid-input' ) ;
4444 return true ;
4545 } ) ;
46- assert . throws ( ( ) => occurrenceView ( { } ) , ( error ) => error . kind === 'invalid-request' ) ;
46+ assert . throws ( ( ) => eventRecordView ( { } ) , ( error ) => error . kind === 'invalid-request' ) ;
4747} ) ;
4848
4949test ( 'the metadata accessor and the creation-revision read follow the declared contract' , async ( ) => {
@@ -54,7 +54,7 @@ test('the metadata accessor and the creation-revision read follow the declared c
5454 {
5555 id : 'incorporation' , datasetIdentifier : 'register' , route : 'incorporations' ,
5656 operations : [ ] , readableFields : [ ] , schema : '/v1/schemas/incorporation' ,
57- occurrence : input . descriptor ,
57+ eventRecord : input . descriptor ,
5858 } ,
5959 {
6060 id : 'note' , datasetIdentifier : 'register' , route : 'notes' , operations : [ ] ,
@@ -105,32 +105,32 @@ test('the metadata accessor and the creation-revision read follow the declared c
105105 try {
106106 const client = new BaseRegistryClient ( { baseUrl : `http://127.0.0.1:${ server . address ( ) . port } ` } ) ;
107107 const contract = await client . registryContract ( ) ;
108- const descriptor = JSON . parse ( contract . occurrenceDescriptor ( 'incorporation' ) ) ;
108+ const descriptor = JSON . parse ( contract . eventRecordDescriptor ( 'incorporation' ) ) ;
109109 assert . equal ( descriptor . descriptorVersion , 1 ) ;
110110 assert . equal ( descriptor . label , 'Incorporation' ) ;
111111 for ( const absent of [ 'note' , 'unknown-type' ] ) {
112- assert . throws ( ( ) => contract . occurrenceDescriptor ( absent ) , ( error ) => {
113- assert . equal ( error . kind , 'occurrence ' ) ;
114- assert . equal ( error . code , 'not-an-occurrence ' ) ;
112+ assert . throws ( ( ) => contract . eventRecordDescriptor ( absent ) , ( error ) => {
113+ assert . equal ( error . kind , 'event-record ' ) ;
114+ assert . equal ( error . code , 'not-an-event-record ' ) ;
115115 return true ;
116116 } ) ;
117117 }
118118
119- const text = await client . occurrenceCreationRevision ( 'incorporations' , recordId ) ;
119+ const text = await client . eventRecordCreationRevision ( 'incorporations' , recordId ) ;
120120 assert . deepEqual ( JSON . parse ( text ) , {
121121 recordType : 'incorporation' , recordId, revision : '1' ,
122122 createdAt : '2026-10-26T08:15:30.123456Z' ,
123123 } ) ;
124124 assert . ok ( requests . some ( ( url ) => url . includes ( `/incorporations/${ recordId } /revisions/1` ) ) ) ;
125- assert . equal ( await client . occurrenceCreationRevision ( 'incorporations' , hiddenId ) , null ) ;
125+ assert . equal ( await client . eventRecordCreationRevision ( 'incorporations' , hiddenId ) , null ) ;
126126 input . creationRevision = JSON . parse ( text ) ;
127127 assert . deepEqual (
128- JSON . parse ( occurrenceView ( JSON . stringify ( input ) ) ) . recordedAt ,
128+ JSON . parse ( eventRecordView ( JSON . stringify ( input ) ) ) . recordedAt ,
129129 { status : 'available' , type : 'instant' , value : '2026-10-26T08:15:30.123456Z' } ,
130130 ) ;
131131 input . creationRevision . recordType = 'ownership-transfer' ;
132- assert . throws ( ( ) => occurrenceView ( JSON . stringify ( input ) ) , ( error ) => {
133- assert . equal ( error . kind , 'occurrence ' ) ;
132+ assert . throws ( ( ) => eventRecordView ( JSON . stringify ( input ) ) , ( error ) => {
133+ assert . equal ( error . kind , 'event-record ' ) ;
134134 assert . equal ( error . code , 'wrong-record-evidence' ) ;
135135 assert . doesNotMatch ( error . message , / o w n e r s h i p - t r a n s f e r / ) ;
136136 return true ;
0 commit comments