Skip to content

Commit 03994f7

Browse files
committed
Clean up events.
- Move 'invalid reserved term' to safe validator. - Improve asserts. - Update test names.
1 parent 9017c62 commit 03994f7

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

lib/events.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,14 @@ function _handle({event, handlers}) {
101101
}
102102

103103
const _notSafeEventCodes = new Set([
104+
'dropping empty object',
105+
'dropping free-floating scalar',
104106
'dropping object with only @id',
105107
'dropping object with only @list',
106108
'dropping object with only @value',
107-
'dropping empty object',
108-
'dropping free-floating scalar',
109109
'invalid @language value',
110110
'invalid property expansion',
111+
'invalid reserved term',
111112
'no value after expansion',
112113
'relative IRI after expansion'
113114
]);
@@ -127,7 +128,6 @@ api.safeEventHandler = function safeEventHandler({event, next}) {
127128

128129
const _notStrictEventCodes = new Set([
129130
..._notSafeEventCodes,
130-
'invalid reserved term'
131131
]);
132132

133133
// strict handler that rejects all warning conditions

tests/misc.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,7 @@ describe('events', () => {
660660
error = e;
661661
}
662662

663-
assert(error);
663+
assert(error, 'missing safe validation error');
664664
}
665665
// test passes with strict event handler
666666
if(testStrict) {
@@ -683,7 +683,7 @@ describe('events', () => {
683683
error = e;
684684
}
685685

686-
assert(error);
686+
assert(error, 'missing strict validation error');
687687
}
688688
}
689689

@@ -1118,7 +1118,7 @@ describe('events', () => {
11181118
});
11191119
});
11201120

1121-
describe('unmappedValue', () => {
1121+
describe('values', () => {
11221122
it('should have zero counts with empty list', async () => {
11231123
const input = [];
11241124
const expected = [];
@@ -1197,7 +1197,7 @@ describe('events', () => {
11971197
});
11981198
});
11991199

1200-
it('should notify for @set free-floating scaler', async () => {
1200+
it('should emit for @set free-floating scaler', async () => {
12011201
const input =
12021202
{
12031203
"@set": [
@@ -1250,7 +1250,7 @@ describe('events', () => {
12501250
});
12511251
});
12521252

1253-
it('should notify for @list free-floating scaler', async () => {
1253+
it('should emit for @list free-floating scaler', async () => {
12541254
const input =
12551255
{
12561256
"@list": [
@@ -1293,7 +1293,7 @@ describe('events', () => {
12931293
});
12941294
});
12951295

1296-
it('should notify for null @value', async () => {
1296+
it('should emit for null @value', async () => {
12971297
const input =
12981298
{
12991299
"urn:property": {
@@ -1326,7 +1326,7 @@ describe('events', () => {
13261326
});
13271327
});
13281328

1329-
it('should notify for @language alone', async () => {
1329+
it('should emit for @language alone', async () => {
13301330
const input =
13311331
{
13321332
"urn:property": {
@@ -1438,7 +1438,7 @@ describe('events', () => {
14381438
});
14391439
});
14401440

1441-
describe('unmappedProperty', () => {
1441+
describe('properties', () => {
14421442
it('should have zero counts with absolute term', async () => {
14431443
const input =
14441444
{

0 commit comments

Comments
 (0)