Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
},
"devDependencies": {
"@rubensworks/eslint-config": "1.0.1",
"@types/jest": "^29.0.0",
"@types/jest": "^30.0.0",
"@types/stream-to-array": "^2.3.0",
"@types/streamify-string": "^1.0.0",
"@typescript-eslint/eslint-plugin": "^5.0.0",
Expand All @@ -64,8 +64,8 @@
"eslint-plugin-jest": "^26.0.0",
"eslint-plugin-tsdoc": "^0.2.7",
"eslint-plugin-unused-imports": "^2.0.0",
"jest": "^29.0.0",
"jest-mock": "^29.0.0",
"jest": "^30.0.0",
"jest-mock": "^30.0.0",
"jest-rdf": "^2.0.0",
"jshint": "^2.1.10",
"manual-git-changelog": "^1.0.1",
Expand Down
30 changes: 15 additions & 15 deletions test/integration/instantiateResourceConfigComponent-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters with multiple values as list', async() => {
Expand Down Expand Up @@ -181,7 +181,7 @@ describe('construction with component configs as Resource', () => {

it('with undefined variables', async() => {
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^Undefined variable: ex:var1/u);
.toThrow(/^Undefined variable: ex:var1/u);
});

it('with variables that are undefined', async() => {
Expand All @@ -190,7 +190,7 @@ describe('construction with component configs as Resource', () => {
'ex:var3': 'C',
};
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^Undefined variable: ex:var2/u);
.toThrow(/^Undefined variable: ex:var2/u);
});
});
});
Expand Down Expand Up @@ -238,7 +238,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
.toThrow(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
});

it('instantiated with a config with all parameters as multiple non-list values should throw', async() => {
Expand All @@ -250,7 +250,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': [ '"true"', '"false"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters as singular values as list', async() => {
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters with multiple values as list should throw', async() => {
Expand All @@ -339,7 +339,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': { list: [ '"C1"', '"C2"' ]},
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
});

describe('instantiated with a config with variables', () => {
Expand Down Expand Up @@ -370,7 +370,7 @@ describe('construction with component configs as Resource', () => {

it('with undefined variables', async() => {
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^Undefined variable: ex:var1/u);
.toThrow(/^Undefined variable: ex:var1/u);
});

it('with variables that are undefined', async() => {
Expand All @@ -379,7 +379,7 @@ describe('construction with component configs as Resource', () => {
'ex:var3': 'C',
};
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^Undefined variable: ex:var2/u);
.toThrow(/^Undefined variable: ex:var2/u);
});
});
});
Expand Down Expand Up @@ -422,7 +422,7 @@ describe('construction with component configs as Resource', () => {
types: 'http://example.org/n3#Lexer',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
});
});

Expand Down Expand Up @@ -773,7 +773,7 @@ describe('construction with component configs as Resource', () => {
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
// eslint-disable-next-line max-len
.toThrowError(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
.toThrow(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
});

it('instantiated with a config with all parameters as multiple values in list', async() => {
Expand All @@ -785,7 +785,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': [ '"true"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters as singular value in RDF list', async() => {
Expand Down Expand Up @@ -842,15 +842,15 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
});

it('instantiated with a config without parameters', async() => {
const config = objectLoader.createCompactedResource({
types: 'http://example.org/n3#Lexer',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
});
});

Expand Down Expand Up @@ -879,7 +879,7 @@ describe('construction with component configs as Resource', () => {
'http://example.org/n3#comments': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
});

it('instantiated with a config without parameters', async() => {
Expand Down
30 changes: 15 additions & 15 deletions test/integration/instantiateResourceConfigComponentMapped-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters with multiple values as list', async() => {
Expand Down Expand Up @@ -271,7 +271,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
.toThrow(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]"/u);
});

it('instantiated with a config with all parameters as singular value in list', async() => {
Expand Down Expand Up @@ -299,7 +299,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters with multiple values as list', async() => {
Expand Down Expand Up @@ -363,7 +363,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#lineMode': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
.toThrow(/The value "true" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
});

it('instantiated with a config with all parameters as list', async() => {
Expand All @@ -373,7 +373,7 @@ describe('construction with mapped component configs as Resource', () => {
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
// eslint-disable-next-line max-len
.toThrowError(/The value "\[true\]" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
.toThrow(/The value "\[true\]" for parameter ".*lineMode" is not of required range type ".*string\[\]\[\]"/u);
});

it('instantiated with a config with all parameters as nested list', async() => {
Expand Down Expand Up @@ -453,7 +453,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': [ '"C1"', '"C2"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters with multiple values as list', async() => {
Expand All @@ -464,7 +464,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': { list: [ '"C1"', '"C2"' ]},
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
});

describe('instantiated with a config with variables', () => {
Expand Down Expand Up @@ -495,7 +495,7 @@ describe('construction with mapped component configs as Resource', () => {

it('with undefined variables', async() => {
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^Undefined variable: ex:var1/u);
.toThrow(/^Undefined variable: ex:var1/u);
});

it('with variables that are undefined', async() => {
Expand All @@ -504,7 +504,7 @@ describe('construction with mapped component configs as Resource', () => {
'ex:var3': 'C',
};
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^Undefined variable: ex:var2/u);
.toThrow(/^Undefined variable: ex:var2/u);
});
});
});
Expand Down Expand Up @@ -569,7 +569,7 @@ describe('construction with mapped component configs as Resource', () => {
types: 'http://example.org/n3#Lexer',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/^The value "undefined" for parameter ".*lineMode" is not of required range type ".*string"/u);
});
});

Expand Down Expand Up @@ -1074,7 +1074,7 @@ describe('construction with mapped component configs as Resource', () => {
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
// eslint-disable-next-line max-len
.toThrowError(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
.toThrow(/The value "true" for parameter ".*comments" is not of required range type ".*string\[\] | undefined"/u);
});

it('instantiated with a config with all parameters as multiple values in list', async() => {
Expand All @@ -1086,7 +1086,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': [ '"true"' ],
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for parameter http://example.org/n3#lineMode in ex:config. RDF lists should be used for defining multiple values.`);
});

it('instantiated with a config with all parameters as singular value in RDF list', async() => {
Expand Down Expand Up @@ -1165,15 +1165,15 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
});

it('instantiated with a config without parameters', async() => {
const config = objectLoader.createCompactedResource({
types: 'http://example.org/n3#Lexer',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*n3" is not of required range type ".*string"/u);
});
});

Expand Down Expand Up @@ -1224,7 +1224,7 @@ describe('construction with mapped component configs as Resource', () => {
'http://example.org/n3#comments': '"true"',
});
await expect(configConstructorPool.instantiate(config, settings)).rejects
.toThrowError(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
.toThrow(/The value ".*" for parameter ".*lineMode" is not of required range type ".*string"/u);
});

it('instantiated with a config without parameters', async() => {
Expand Down
12 changes: 6 additions & 6 deletions test/unit/construction/ConfigConstructor-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe('ConfigConstructor', () => {
objectLoader.createCompactedResource('"GHI"'),
];
await expect(constructor.getArgumentValues(values, settings)).rejects
.toThrowError(`Detected multiple values for an argument. RDF lists should be used for defining multiple values.`);
.toThrow(`Detected multiple values for an argument. RDF lists should be used for defining multiple values.`);
});

it('should handle an RDF list', async() => {
Expand Down Expand Up @@ -221,7 +221,7 @@ describe('ConfigConstructor', () => {
},
});
await expect(constructor.getArgumentValue(resource, settings)).rejects
.toThrowError(/^Missing key in fields entry/u);
.toThrow(/^Missing key in fields entry/u);
});

it('can use dereferenced IRI values as keys', async() => {
Expand Down Expand Up @@ -267,7 +267,7 @@ describe('ConfigConstructor', () => {
},
});
await expect(constructor.getArgumentValue(resource, settings)).rejects
.toThrowError(/^Illegal non-string key \(ex:abc as NamedNode\) in fields entry/u);
.toThrow(/^Illegal non-string key \(ex:abc as NamedNode\) in fields entry/u);
});

it('should ignore fields without value', async() => {
Expand Down Expand Up @@ -348,7 +348,7 @@ describe('ConfigConstructor', () => {
],
});
await expect(constructor.getArgumentValue(resource, settings)).rejects
.toThrowError(/^Missing value in array elements entry/u);
.toThrow(/^Missing value in array elements entry/u);
});
});

Expand Down Expand Up @@ -519,7 +519,7 @@ describe('ConfigConstructor', () => {
it('should throw on graph terms', async() => {
const resource = new Resource({ term: DF.defaultGraph() });
await expect(constructor.getArgumentValue(resource, settings)).rejects
.toThrowError(/^Unsupported argument value during config construction/u);
.toThrow(/^Unsupported argument value during config construction/u);
});
});

Expand Down Expand Up @@ -565,7 +565,7 @@ describe('ConfigConstructor', () => {
arguments: '"ABC"',
});
await expect(constructor.createArguments(config, settings)).rejects
.toThrowError(/^Detected non-RDF-list as value for config arguments/u);
.toThrow(/^Detected non-RDF-list as value for config arguments/u);
});
});

Expand Down
Loading