mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
chore: Update eslint dependencies
This commit is contained in:
parent
65d1eeb0a2
commit
af049124bf
@ -83,6 +83,10 @@ module.exports = {
|
||||
'unicorn/no-fn-reference-in-iterator': 'off',
|
||||
'unicorn/no-object-as-default-parameter': 'off',
|
||||
'unicorn/numeric-separators-style': 'off',
|
||||
// At function only supported in Node v16.6.0
|
||||
'unicorn/prefer-at': 'off',
|
||||
// Does not make sense for more complex cases
|
||||
'unicorn/prefer-object-from-entries': 'off',
|
||||
// Can get ugly with large single statements
|
||||
'unicorn/prefer-ternary': 'off',
|
||||
'yield-star-spacing': [ 'error', 'after' ],
|
||||
|
3191
package-lock.json
generated
3191
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
16
package.json
16
package.json
@ -141,17 +141,17 @@
|
||||
"@types/jest": "^27.0.0",
|
||||
"@types/set-cookie-parser": "^2.4.0",
|
||||
"@types/supertest": "^2.0.11",
|
||||
"@typescript-eslint/eslint-plugin": "^4.28.1",
|
||||
"@typescript-eslint/parser": "^4.28.1",
|
||||
"@typescript-eslint/eslint-plugin": "^5.3.0",
|
||||
"@typescript-eslint/parser": "^5.3.0",
|
||||
"cheerio": "^1.0.0-rc.10",
|
||||
"componentsjs-generator": "^2.6.0",
|
||||
"eslint": "^7.29.0",
|
||||
"eslint-config-es": "^3.20.3",
|
||||
"eslint-import-resolver-typescript": "^2.4.0",
|
||||
"eslint-plugin-import": "^2.23.4",
|
||||
"eslint-plugin-jest": "^24.3.6",
|
||||
"eslint": "^8.4.1",
|
||||
"eslint-config-es": "4.1.0",
|
||||
"eslint-import-resolver-typescript": "^2.5.0",
|
||||
"eslint-plugin-import": "^2.25.3",
|
||||
"eslint-plugin-jest": "^25.3.0",
|
||||
"eslint-plugin-tsdoc": "^0.2.14",
|
||||
"eslint-plugin-unused-imports": "^1.1.1",
|
||||
"eslint-plugin-unused-imports": "^2.0.0",
|
||||
"fs-extra": "^10.0.0",
|
||||
"husky": "^4.3.8",
|
||||
"jest": "^27.0.6",
|
||||
|
@ -128,7 +128,7 @@ export class IdentityProviderFactory implements ProviderFactory {
|
||||
// Cast necessary due to typing conflict between jose 2.x and 3.x
|
||||
config.jwks = await this.generateJwks() as any;
|
||||
config.cookies = {
|
||||
...config.cookies ?? {},
|
||||
...config.cookies,
|
||||
keys: await this.generateCookieKeys(),
|
||||
};
|
||||
|
||||
|
@ -374,7 +374,7 @@ describe('A Solid server with IDP', (): void => {
|
||||
|
||||
expect(res.status).toBe(200);
|
||||
// https://solid.github.io/authentication-panel/solid-oidc/#discovery
|
||||
expect(jsonBody.solid_oidc_supported).toEqual('https://solidproject.org/TR/solid-oidc');
|
||||
expect(jsonBody.solid_oidc_supported).toBe('https://solidproject.org/TR/solid-oidc');
|
||||
});
|
||||
|
||||
it('should return correct error output.', async(): Promise<void> => {
|
||||
|
@ -23,8 +23,8 @@ describe('A ChainedConverter', (): void => {
|
||||
identifier: { path: 'path' },
|
||||
});
|
||||
|
||||
await expect(readableToString(result.data)).resolves.toEqual('<http://test.com/s> <http://test.com/p> <http://test.com/o>.\n');
|
||||
expect(result.metadata.contentType).toEqual('text/turtle');
|
||||
await expect(readableToString(result.data)).resolves.toBe('<http://test.com/s> <http://test.com/p> <http://test.com/o>.\n');
|
||||
expect(result.metadata.contentType).toBe('text/turtle');
|
||||
});
|
||||
|
||||
it('can convert from turtle to JSON-LD.', async(): Promise<void> => {
|
||||
@ -42,6 +42,6 @@ describe('A ChainedConverter', (): void => {
|
||||
expect(JSON.parse(await readableToString(result.data))).toEqual(
|
||||
[{ '@id': 'http://test.com/s', 'http://test.com/p': [{ '@id': 'http://test.com/o' }]}],
|
||||
);
|
||||
expect(result.metadata.contentType).toEqual('application/ld+json');
|
||||
expect(result.metadata.contentType).toBe('application/ld+json');
|
||||
});
|
||||
});
|
||||
|
@ -53,7 +53,7 @@ describe('A BasicRequestParser with simple input parsers', (): void => {
|
||||
metadata: expect.any(RepresentationMetadata),
|
||||
},
|
||||
});
|
||||
expect(result.body?.metadata.contentType).toEqual('text/turtle');
|
||||
expect(result.body?.metadata.contentType).toBe('text/turtle');
|
||||
|
||||
await expect(arrayifyStream(result.body.data)).resolves.toEqual(
|
||||
[ '<http://test.com/s> <http://test.com/p> <http://test.com/o>.' ],
|
||||
|
@ -49,7 +49,7 @@ describe('A BasicResponseWriter', (): void => {
|
||||
response.on('end', (): void => {
|
||||
expect(response._isEndCalled()).toBeTruthy();
|
||||
expect(response._getStatusCode()).toBe(201);
|
||||
expect(response._getData()).toEqual('<http://test.com/s> <http://test.com/p> <http://test.com/o>.');
|
||||
expect(response._getData()).toBe('<http://test.com/s> <http://test.com/p> <http://test.com/o>.');
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
@ -35,7 +35,7 @@ describe('A RepresentationMetadata', (): void => {
|
||||
describe('constructor', (): void => {
|
||||
it('creates a blank node if no identifier was given.', async(): Promise<void> => {
|
||||
metadata = new RepresentationMetadata();
|
||||
expect(metadata.identifier.termType).toEqual('BlankNode');
|
||||
expect(metadata.identifier.termType).toBe('BlankNode');
|
||||
expect(metadata.quads()).toHaveLength(0);
|
||||
});
|
||||
|
||||
@ -51,13 +51,13 @@ describe('A RepresentationMetadata', (): void => {
|
||||
|
||||
it('converts string to content type.', async(): Promise<void> => {
|
||||
metadata = new RepresentationMetadata('text/turtle');
|
||||
expect(metadata.contentType).toEqual('text/turtle');
|
||||
expect(metadata.contentType).toBe('text/turtle');
|
||||
|
||||
metadata = new RepresentationMetadata({ path: 'identifier' }, 'text/turtle');
|
||||
expect(metadata.contentType).toEqual('text/turtle');
|
||||
expect(metadata.contentType).toBe('text/turtle');
|
||||
|
||||
metadata = new RepresentationMetadata(new RepresentationMetadata(), 'text/turtle');
|
||||
expect(metadata.contentType).toEqual('text/turtle');
|
||||
expect(metadata.contentType).toBe('text/turtle');
|
||||
});
|
||||
|
||||
it('copies an other metadata object.', async(): Promise<void> => {
|
||||
@ -275,7 +275,7 @@ describe('A RepresentationMetadata', (): void => {
|
||||
expect(metadata.contentType).toBeUndefined();
|
||||
metadata.contentType = 'a/b';
|
||||
expect(metadata.get(CONTENT_TYPE)).toEqualRdfTerm(literal('a/b'));
|
||||
expect(metadata.contentType).toEqual('a/b');
|
||||
expect(metadata.contentType).toBe('a/b');
|
||||
metadata.contentType = undefined;
|
||||
expect(metadata.contentType).toBeUndefined();
|
||||
});
|
||||
|
@ -95,7 +95,7 @@ describe('An IdentityProviderFactory', (): void => {
|
||||
expect(config.jwks).toEqual({ keys: [ expect.objectContaining({ kty: 'RSA' }) ]});
|
||||
expect(config.routes).toEqual(routes);
|
||||
|
||||
expect((config.interactions?.url as any)()).toEqual('/idp/');
|
||||
expect((config.interactions?.url as any)()).toBe('/idp/');
|
||||
expect((config.audiences as any)(null, null, {}, 'access_token')).toBe('solid');
|
||||
expect((config.audiences as any)(null, null, { clientId: 'clientId' }, 'client_credentials')).toBe('clientId');
|
||||
|
||||
|
@ -11,12 +11,12 @@ describe('LogUtil', (): void => {
|
||||
|
||||
it('allows creating a lazy logger for a string label.', async(): Promise<void> => {
|
||||
expect(getLoggerFor('MyLabel')).toBeInstanceOf(LazyLogger);
|
||||
expect((getLoggerFor('MyLabel') as any).label).toEqual('MyLabel');
|
||||
expect((getLoggerFor('MyLabel') as any).label).toBe('MyLabel');
|
||||
});
|
||||
|
||||
it('allows creating a lazy logger for a class instance.', async(): Promise<void> => {
|
||||
expect(getLoggerFor(new VoidLogger())).toBeInstanceOf(LazyLogger);
|
||||
expect((getLoggerFor(new VoidLogger()) as any).label).toEqual('VoidLogger');
|
||||
expect((getLoggerFor(new VoidLogger()) as any).label).toBe('VoidLogger');
|
||||
});
|
||||
|
||||
it('allows setting the global logger factory.', async(): Promise<void> => {
|
||||
|
@ -13,7 +13,7 @@ describe('WinstonLoggerFactory', (): void => {
|
||||
const logger = factory.createLogger('MyLabel');
|
||||
expect(logger).toBeInstanceOf(WinstonLogger);
|
||||
const innerLogger: Logger = (logger as any).logger;
|
||||
expect(innerLogger.level).toEqual('debug');
|
||||
expect(innerLogger.level).toBe('debug');
|
||||
expect(innerLogger.format).toBeTruthy();
|
||||
expect(innerLogger.transports).toHaveLength(1);
|
||||
});
|
||||
|
@ -180,7 +180,7 @@ describe('A DataAccessorBasedStore', (): void => {
|
||||
const result = await store.getRepresentation(resourceID);
|
||||
expect(result).toMatchObject({ binary: true });
|
||||
expect(await arrayifyStream(result.data)).toEqual([ resourceData ]);
|
||||
expect(result.metadata.contentType).toEqual('text/plain');
|
||||
expect(result.metadata.contentType).toBe('text/plain');
|
||||
expect(result.metadata.get('AUXILIARY')?.value).toBe(auxiliaryStrategy.getAuxiliaryIdentifier(resourceID).path);
|
||||
});
|
||||
|
||||
@ -690,7 +690,7 @@ describe('A DataAccessorBasedStore', (): void => {
|
||||
{ path: root },
|
||||
]);
|
||||
expect(accessor.data[`${root}resource`]).toBeUndefined();
|
||||
expect(accessor.data[`${root}resource.dummy`]).not.toBeUndefined();
|
||||
expect(accessor.data[`${root}resource.dummy`]).toBeDefined();
|
||||
expect(logger.error).toHaveBeenCalledTimes(1);
|
||||
expect(logger.error).toHaveBeenLastCalledWith(
|
||||
'Error deleting auxiliary resource http://test.com/resource.dummy: auxiliary error!',
|
||||
|
@ -109,16 +109,16 @@ describe('ConversionUtil', (): void => {
|
||||
describe('#matchesMediaPreferences', (): void => {
|
||||
it('returns false if there are no matches.', async(): Promise<void> => {
|
||||
const preferences: ValuePreferences = { 'a/x': 1, 'b/x': 0.5, 'c/x': 0 };
|
||||
expect(matchesMediaPreferences('c/x', preferences)).toEqual(false);
|
||||
expect(matchesMediaPreferences('c/x', preferences)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns true if there are matches.', async(): Promise<void> => {
|
||||
const preferences: ValuePreferences = { 'a/x': 1, 'b/x': 0.5, 'c/x': 0 };
|
||||
expect(matchesMediaPreferences('b/x', preferences)).toEqual(true);
|
||||
expect(matchesMediaPreferences('b/x', preferences)).toBe(true);
|
||||
});
|
||||
|
||||
it('matches anything if there are no preferences.', async(): Promise<void> => {
|
||||
expect(matchesMediaPreferences('a/a')).toEqual(true);
|
||||
expect(matchesMediaPreferences('a/a')).toBe(true);
|
||||
});
|
||||
|
||||
it('does not match internal types if not in the preferences.', async(): Promise<void> => {
|
||||
|
@ -60,7 +60,7 @@ describe('A QuadToRdfConverter', (): void => {
|
||||
binary: true,
|
||||
metadata: expect.any(RepresentationMetadata),
|
||||
});
|
||||
expect(result.metadata.contentType).toEqual('text/turtle');
|
||||
expect(result.metadata.contentType).toBe('text/turtle');
|
||||
await expect(readableToString(result.data)).resolves.toEqual(
|
||||
`<http://test.com/s> <http://test.com/p> <http://test.com/o>.
|
||||
`,
|
||||
@ -78,7 +78,7 @@ describe('A QuadToRdfConverter', (): void => {
|
||||
metadata);
|
||||
const preferences: RepresentationPreferences = { type: { 'text/turtle': 1 }};
|
||||
const result = await converter.handle({ identifier, representation, preferences });
|
||||
expect(result.metadata.contentType).toEqual('text/turtle');
|
||||
expect(result.metadata.contentType).toBe('text/turtle');
|
||||
await expect(readableToString(result.data)).resolves.toEqual(
|
||||
`@prefix dc: <http://purl.org/dc/terms/>.
|
||||
@prefix test: <http://test.com/>.
|
||||
@ -97,7 +97,7 @@ test:s dc:modified test:o.
|
||||
metadata);
|
||||
const preferences: RepresentationPreferences = { type: { 'text/turtle': 1 }};
|
||||
const result = await converter.handle({ identifier, representation, preferences });
|
||||
expect(result.metadata.contentType).toEqual('text/turtle');
|
||||
expect(result.metadata.contentType).toBe('text/turtle');
|
||||
await expect(readableToString(result.data)).resolves.toEqual(
|
||||
`<> <#abc> <def/ghi>.
|
||||
`,
|
||||
@ -118,7 +118,7 @@ test:s dc:modified test:o.
|
||||
binary: true,
|
||||
metadata: expect.any(RepresentationMetadata),
|
||||
});
|
||||
expect(result.metadata.contentType).toEqual('application/ld+json');
|
||||
expect(result.metadata.contentType).toBe('application/ld+json');
|
||||
await expect(readableToString(result.data)).resolves.toEqual(
|
||||
`[
|
||||
{
|
||||
|
@ -43,7 +43,7 @@ describe('A WrappedExpiringStorage', (): void => {
|
||||
|
||||
it('returns data if it has not expired.', async(): Promise<void> => {
|
||||
source.get.mockResolvedValueOnce(createExpires('data!', tomorrow));
|
||||
await expect(storage.get('key')).resolves.toEqual('data!');
|
||||
await expect(storage.get('key')).resolves.toBe('data!');
|
||||
});
|
||||
|
||||
it('deletes expired data when trying to get it.', async(): Promise<void> => {
|
||||
|
@ -25,17 +25,17 @@ import {
|
||||
describe('PathUtil', (): void => {
|
||||
describe('#normalizeFilePath', (): void => {
|
||||
it('normalizes POSIX paths.', async(): Promise<void> => {
|
||||
expect(normalizeFilePath('/foo/bar/../baz')).toEqual('/foo/baz');
|
||||
expect(normalizeFilePath('/foo/bar/../baz')).toBe('/foo/baz');
|
||||
});
|
||||
|
||||
it('normalizes Windows paths.', async(): Promise<void> => {
|
||||
expect(normalizeFilePath('c:\\foo\\bar\\..\\baz')).toEqual('c:/foo/baz');
|
||||
expect(normalizeFilePath('c:\\foo\\bar\\..\\baz')).toBe('c:/foo/baz');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#joinFilePath', (): void => {
|
||||
it('joins POSIX paths.', async(): Promise<void> => {
|
||||
expect(joinFilePath('/foo/bar/', '..', '/baz')).toEqual('/foo/baz');
|
||||
expect(joinFilePath('/foo/bar/', '..', '/baz')).toBe('/foo/baz');
|
||||
});
|
||||
|
||||
it('joins Windows paths.', async(): Promise<void> => {
|
||||
@ -45,11 +45,11 @@ describe('PathUtil', (): void => {
|
||||
|
||||
describe('#absoluteFilePath', (): void => {
|
||||
it('does not change absolute posix paths.', async(): Promise<void> => {
|
||||
expect(absoluteFilePath('/foo/bar/')).toEqual('/foo/bar/');
|
||||
expect(absoluteFilePath('/foo/bar/')).toBe('/foo/bar/');
|
||||
});
|
||||
|
||||
it('converts absolute win32 paths to posix paths.', async(): Promise<void> => {
|
||||
expect(absoluteFilePath('C:\\foo\\bar')).toEqual('C:/foo/bar');
|
||||
expect(absoluteFilePath('C:\\foo\\bar')).toBe('C:/foo/bar');
|
||||
});
|
||||
|
||||
it('makes relative paths absolute.', async(): Promise<void> => {
|
||||
@ -59,70 +59,70 @@ describe('PathUtil', (): void => {
|
||||
|
||||
describe('#ensureTrailingSlash', (): void => {
|
||||
it('makes sure there is always exactly 1 slash.', async(): Promise<void> => {
|
||||
expect(ensureTrailingSlash('http://test.com')).toEqual('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com/')).toEqual('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com//')).toEqual('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com///')).toEqual('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com')).toBe('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com/')).toBe('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com//')).toBe('http://test.com/');
|
||||
expect(ensureTrailingSlash('http://test.com///')).toBe('http://test.com/');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#trimTrailingSlashes', (): void => {
|
||||
it('removes all trailing slashes.', async(): Promise<void> => {
|
||||
expect(trimTrailingSlashes('http://test.com')).toEqual('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com/')).toEqual('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com//')).toEqual('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com///')).toEqual('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com')).toBe('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com/')).toBe('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com//')).toBe('http://test.com');
|
||||
expect(trimTrailingSlashes('http://test.com///')).toBe('http://test.com');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#getExtension', (): void => {
|
||||
it('returns the extension of a path.', async(): Promise<void> => {
|
||||
expect(getExtension('/a/b.txt')).toEqual('txt');
|
||||
expect(getExtension('/a/btxt')).toEqual('');
|
||||
expect(getExtension('/a/b.txt')).toBe('txt');
|
||||
expect(getExtension('/a/btxt')).toBe('');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#toCanonicalUriPath', (): void => {
|
||||
it('encodes only the necessary parts.', async(): Promise<void> => {
|
||||
expect(toCanonicalUriPath('/a%20path&/name')).toEqual('/a%20path%26/name');
|
||||
expect(toCanonicalUriPath('/a%20path&/name')).toBe('/a%20path%26/name');
|
||||
});
|
||||
|
||||
it('leaves the query string untouched.', async(): Promise<void> => {
|
||||
expect(toCanonicalUriPath('/a%20path&/name?abc=def&xyz')).toEqual('/a%20path%26/name?abc=def&xyz');
|
||||
expect(toCanonicalUriPath('/a%20path&/name?abc=def&xyz')).toBe('/a%20path%26/name?abc=def&xyz');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#decodeUriPathComponents', (): void => {
|
||||
it('decodes all parts of a path.', async(): Promise<void> => {
|
||||
expect(decodeUriPathComponents('/a%20path&/name')).toEqual('/a path&/name');
|
||||
expect(decodeUriPathComponents('/a%20path&/name')).toBe('/a path&/name');
|
||||
});
|
||||
|
||||
it('leaves the query string untouched.', async(): Promise<void> => {
|
||||
expect(decodeUriPathComponents('/a%20path&/name?abc=def&xyz')).toEqual('/a path&/name?abc=def&xyz');
|
||||
expect(decodeUriPathComponents('/a%20path&/name?abc=def&xyz')).toBe('/a path&/name?abc=def&xyz');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#encodeUriPathComponents', (): void => {
|
||||
it('encodes all parts of a path.', async(): Promise<void> => {
|
||||
expect(encodeUriPathComponents('/a%20path&/name')).toEqual('/a%2520path%26/name');
|
||||
expect(encodeUriPathComponents('/a%20path&/name')).toBe('/a%2520path%26/name');
|
||||
});
|
||||
|
||||
it('leaves the query string untouched.', async(): Promise<void> => {
|
||||
expect(encodeUriPathComponents('/a%20path&/name?abc=def&xyz')).toEqual('/a%2520path%26/name?abc=def&xyz');
|
||||
expect(encodeUriPathComponents('/a%20path&/name?abc=def&xyz')).toBe('/a%2520path%26/name?abc=def&xyz');
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isContainerPath', (): void => {
|
||||
it('returns true if the path ends with a slash.', async(): Promise<void> => {
|
||||
expect(isContainerPath('/a/b')).toEqual(false);
|
||||
expect(isContainerPath('/a/b/')).toEqual(true);
|
||||
expect(isContainerPath('/a/b')).toBe(false);
|
||||
expect(isContainerPath('/a/b/')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#isContainerIdentifier', (): void => {
|
||||
it('works af isContainerPath but for identifiers.', async(): Promise<void> => {
|
||||
expect(isContainerIdentifier({ path: '/a/b' })).toEqual(false);
|
||||
expect(isContainerIdentifier({ path: '/a/b/' })).toEqual(true);
|
||||
expect(isContainerIdentifier({ path: '/a/b' })).toBe(false);
|
||||
expect(isContainerIdentifier({ path: '/a/b/' })).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@ -159,8 +159,8 @@ describe('PathUtil', (): void => {
|
||||
const regex = createSubdomainRegexp('http://test.com/foo/');
|
||||
expect(regex.exec('http://test.com/foo/')![1]).toBeUndefined();
|
||||
expect(regex.exec('http://test.com/foo/bar')![1]).toBeUndefined();
|
||||
expect(regex.exec('http://alice.test.com/foo/')![1]).toEqual('alice');
|
||||
expect(regex.exec('http://alice.bob.test.com/foo/')![1]).toEqual('alice.bob');
|
||||
expect(regex.exec('http://alice.test.com/foo/')![1]).toBe('alice');
|
||||
expect(regex.exec('http://alice.bob.test.com/foo/')![1]).toBe('alice.bob');
|
||||
expect(regex.exec('http://test.com/')).toBeNull();
|
||||
expect(regex.exec('http://alicetest.com/foo/')).toBeNull();
|
||||
});
|
||||
|
@ -9,23 +9,23 @@ describe('PromiseUtil', (): void => {
|
||||
const resultInfinite = new Promise<boolean>((): void => {});
|
||||
|
||||
it('returns false if no promise is provided.', async(): Promise<void> => {
|
||||
await expect(promiseSome([])).resolves.toEqual(false);
|
||||
await expect(promiseSome([])).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('returns false if no promise returns true.', async(): Promise<void> => {
|
||||
await expect(promiseSome([ resultFalse, resultFalse, resultFalse ])).resolves.toEqual(false);
|
||||
await expect(promiseSome([ resultFalse, resultFalse, resultFalse ])).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('returns true if at least a promise returns true.', async(): Promise<void> => {
|
||||
await expect(promiseSome([ resultFalse, resultTrue, resultFalse ])).resolves.toEqual(true);
|
||||
await expect(promiseSome([ resultFalse, resultTrue, resultFalse ])).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it('does not propagate errors.', async(): Promise<void> => {
|
||||
await expect(promiseSome([ resultError, resultFalse, resultFalse ])).resolves.toEqual(false);
|
||||
await expect(promiseSome([ resultError, resultFalse, resultFalse ])).resolves.toBe(false);
|
||||
});
|
||||
|
||||
it('works with a combination of promises.', async(): Promise<void> => {
|
||||
await expect(promiseSome([ resultError, resultTrue, resultInfinite ])).resolves.toEqual(true);
|
||||
await expect(promiseSome([ resultError, resultTrue, resultInfinite ])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -23,7 +23,7 @@ describe('StreamUtil', (): void => {
|
||||
describe('#readableToString', (): void => {
|
||||
it('concatenates all elements of a Readable.', async(): Promise<void> => {
|
||||
const stream = Readable.from([ 'a', 'b', 'c' ]);
|
||||
await expect(readableToString(stream)).resolves.toEqual('abc');
|
||||
await expect(readableToString(stream)).resolves.toBe('abc');
|
||||
});
|
||||
});
|
||||
|
||||
@ -77,7 +77,7 @@ describe('StreamUtil', (): void => {
|
||||
const input = Readable.from([ 'data' ]);
|
||||
const output = new PassThrough();
|
||||
const piped = pipeSafely(input, output);
|
||||
await expect(readableToString(piped)).resolves.toEqual('data');
|
||||
await expect(readableToString(piped)).resolves.toBe('data');
|
||||
});
|
||||
|
||||
it('pipes errors from one stream to the other.', async(): Promise<void> => {
|
||||
|
@ -4,14 +4,14 @@ describe('An BadRequestHttpError', (): void => {
|
||||
it('has status code 400.', async(): Promise<void> => {
|
||||
const error = new BadRequestHttpError('test');
|
||||
|
||||
expect(error.statusCode).toEqual(400);
|
||||
expect(error.message).toEqual('test');
|
||||
expect(error.name).toEqual('BadRequestHttpError');
|
||||
expect(error.statusCode).toBe(400);
|
||||
expect(error.message).toBe('test');
|
||||
expect(error.name).toBe('BadRequestHttpError');
|
||||
});
|
||||
|
||||
it('has a default message if none was provided.', async(): Promise<void> => {
|
||||
const error = new BadRequestHttpError();
|
||||
|
||||
expect(error.message).toEqual('The given input is not supported by the server configuration.');
|
||||
expect(error.message).toBe('The given input is not supported by the server configuration.');
|
||||
});
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ describe('A StaticHandler', (): void => {
|
||||
|
||||
it('returns the stored value.', async(): Promise<void> => {
|
||||
const handler = new StaticHandler('apple');
|
||||
await expect(handler.handle()).resolves.toEqual('apple');
|
||||
await expect(handler.handle()).resolves.toBe('apple');
|
||||
});
|
||||
|
||||
it('returns undefined if there is no stored value.', async(): Promise<void> => {
|
||||
|
@ -57,7 +57,7 @@ describe('A WaterfallHandler', (): void => {
|
||||
it('handles data if a handler supports it.', async(): Promise<void> => {
|
||||
const handler = new WaterfallHandler([ handlerFalse, handlerTrue ]);
|
||||
|
||||
await expect(handler.handle('test')).resolves.toEqual('test');
|
||||
await expect(handler.handle('test')).resolves.toBe('test');
|
||||
expect(canHandleFn).toHaveBeenCalledTimes(1);
|
||||
expect(handleFn).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
@ -71,7 +71,7 @@ describe('A WaterfallHandler', (): void => {
|
||||
it('only calls the canHandle function once of its handlers when handleSafe is called.', async(): Promise<void> => {
|
||||
const handler = new WaterfallHandler([ handlerFalse, handlerTrue ]);
|
||||
|
||||
await expect(handler.handleSafe('test')).resolves.toEqual('test');
|
||||
await expect(handler.handleSafe('test')).resolves.toBe('test');
|
||||
expect(canHandleFn).toHaveBeenCalledTimes(1);
|
||||
expect(handleFn).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { EventEmitter } from 'events';
|
||||
// eslint-disable-next-line import/default
|
||||
import redis from 'redis';
|
||||
import Redlock from 'redlock';
|
||||
import type { Lock } from 'redlock';
|
||||
|
@ -25,7 +25,6 @@ describe('A SingleThreadedResourceLocker', (): void => {
|
||||
await expect(locker.release(identifier)).rejects.toThrow(InternalServerError);
|
||||
});
|
||||
|
||||
/* eslint-disable jest/valid-expect-in-promise */
|
||||
it('blocks lock acquisition until they are released.', async(): Promise<void> => {
|
||||
const results: number[] = [];
|
||||
const lock1 = locker.acquire(identifier);
|
||||
|
@ -21,7 +21,7 @@ describe('A ChainedTemplateEngine', (): void => {
|
||||
});
|
||||
|
||||
it('chains the engines.', async(): Promise<void> => {
|
||||
await expect(engine.render(contents, template)).resolves.toEqual('body2');
|
||||
await expect(engine.render(contents, template)).resolves.toBe('body2');
|
||||
expect(engines[0].render).toHaveBeenCalledTimes(1);
|
||||
expect(engines[0].render).toHaveBeenLastCalledWith(contents, template);
|
||||
expect(engines[1].render).toHaveBeenCalledTimes(1);
|
||||
@ -30,7 +30,7 @@ describe('A ChainedTemplateEngine', (): void => {
|
||||
|
||||
it('can use a different field to pass along the body.', async(): Promise<void> => {
|
||||
engine = new ChainedTemplateEngine(engines, 'different');
|
||||
await expect(engine.render(contents, template)).resolves.toEqual('body2');
|
||||
await expect(engine.render(contents, template)).resolves.toBe('body2');
|
||||
expect(engines[0].render).toHaveBeenCalledTimes(1);
|
||||
expect(engines[0].render).toHaveBeenLastCalledWith(contents, template);
|
||||
expect(engines[1].render).toHaveBeenCalledTimes(1);
|
||||
|
@ -34,7 +34,7 @@ export function getPort(name: typeof portNames[number]): number {
|
||||
export function describeIf(envFlag: string, name: string, fn: () => void): void {
|
||||
const flag = `TEST_${envFlag.toUpperCase()}`;
|
||||
const enabled = !/^(|0|false)$/iu.test(process.env[flag] ?? '');
|
||||
// eslint-disable-next-line jest/valid-describe, jest/valid-title, jest/no-disabled-tests
|
||||
// eslint-disable-next-line jest/valid-describe-callback, jest/valid-title, jest/no-disabled-tests
|
||||
return enabled ? describe(name, fn) : describe.skip(name, fn);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user