mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
test: Avoid unnecessary nesting.
This commit is contained in:
parent
e4c4d2a781
commit
9a89766858
@ -12,10 +12,11 @@ module.exports = {
|
|||||||
'no-process-env': 'off',
|
'no-process-env': 'off',
|
||||||
|
|
||||||
// We are not using Mocha
|
// We are not using Mocha
|
||||||
'mocha/no-nested-tests': 'off',
|
|
||||||
'mocha/no-exports': 'off',
|
'mocha/no-exports': 'off',
|
||||||
|
'mocha/no-nested-tests': 'off',
|
||||||
'mocha/no-skipped-tests': 'off',
|
'mocha/no-skipped-tests': 'off',
|
||||||
'mocha/no-synchronous-tests': 'off',
|
'mocha/no-synchronous-tests': 'off',
|
||||||
|
'mocha/no-top-level-hooks': 'off',
|
||||||
|
|
||||||
// Need these 2 to run tests for throwing non-Error objects
|
// Need these 2 to run tests for throwing non-Error objects
|
||||||
'@typescript-eslint/no-throw-literal': 'off',
|
'@typescript-eslint/no-throw-literal': 'off',
|
||||||
|
@ -19,7 +19,6 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
|
|||||||
) as HttpHandler;
|
) as HttpHandler;
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('with simple handlers', (): void => {
|
|
||||||
it('can add, read and delete data based on incoming requests.', async(): Promise<void> => {
|
it('can add, read and delete data based on incoming requests.', async(): Promise<void> => {
|
||||||
// POST
|
// POST
|
||||||
let requestUrl = new URL('http://test.com/');
|
let requestUrl = new URL('http://test.com/');
|
||||||
@ -66,9 +65,7 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
|
|||||||
expect(response.statusCode).toBe(404);
|
expect(response.statusCode).toBe(404);
|
||||||
expect(response._getData()).toContain('NotFoundHttpError');
|
expect(response._getData()).toContain('NotFoundHttpError');
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('with simple PATCH handlers', (): void => {
|
|
||||||
it('can handle simple SPARQL updates.', async(): Promise<void> => {
|
it('can handle simple SPARQL updates.', async(): Promise<void> => {
|
||||||
// POST
|
// POST
|
||||||
let requestUrl = new URL('http://test.com/');
|
let requestUrl = new URL('http://test.com/');
|
||||||
@ -129,9 +126,7 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
|
|||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
describe('with simple PUT handlers', (): void => {
|
|
||||||
it('should overwrite the content on PUT request.', async(): Promise<void> => {
|
it('should overwrite the content on PUT request.', async(): Promise<void> => {
|
||||||
// POST
|
// POST
|
||||||
let requestUrl = new URL('http://test.com/');
|
let requestUrl = new URL('http://test.com/');
|
||||||
@ -183,5 +178,4 @@ describe('An integrated AuthenticatedLdpHandler', (): void => {
|
|||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -61,7 +61,7 @@ describe('A server with authorization', (): void => {
|
|||||||
expect(response.statusCode).toBe(205);
|
expect(response.statusCode).toBe(205);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('can not create new entries if not allowed.', async(): Promise<void> => {
|
it('cannot create new entries if not allowed.', async(): Promise<void> => {
|
||||||
await aclHelper.setSimpleAcl({ read: true, write: true, append: true }, 'authenticated');
|
await aclHelper.setSimpleAcl({ read: true, write: true, append: true }, 'authenticated');
|
||||||
|
|
||||||
// POST
|
// POST
|
||||||
|
@ -26,8 +26,7 @@ const stores: [string, any][] = [
|
|||||||
}],
|
}],
|
||||||
];
|
];
|
||||||
|
|
||||||
describe.each(stores)('A server using %s', (name, { storeUrn, setup, teardown }): void => {
|
describe.each(stores)('An LDP handler with auth using %s', (name, { storeUrn, setup, teardown }): void => {
|
||||||
describe('with acl', (): void => {
|
|
||||||
let handler: HttpHandler;
|
let handler: HttpHandler;
|
||||||
let aclHelper: AclTestHelper;
|
let aclHelper: AclTestHelper;
|
||||||
let fileHelper: FileTestHelper;
|
let fileHelper: FileTestHelper;
|
||||||
@ -121,5 +120,4 @@ describe.each(stores)('A server using %s', (name, { storeUrn, setup, teardown })
|
|||||||
response = await fileHelper.deleteResource('http://test.com/permanent.txt', true);
|
response = await fileHelper.deleteResource('http://test.com/permanent.txt', true);
|
||||||
expect(response.statusCode).toBe(401);
|
expect(response.statusCode).toBe(401);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -23,8 +23,7 @@ const stores: [string, any][] = [
|
|||||||
}],
|
}],
|
||||||
];
|
];
|
||||||
|
|
||||||
describe.each(stores)('A server using %s', (name, { storeUrn, setup, teardown }): void => {
|
describe.each(stores)('An LDP handler without auth using %s', (name, { storeUrn, setup, teardown }): void => {
|
||||||
describe('without acl', (): void => {
|
|
||||||
let handler: HttpHandler;
|
let handler: HttpHandler;
|
||||||
let fileHelper: FileTestHelper;
|
let fileHelper: FileTestHelper;
|
||||||
|
|
||||||
@ -222,5 +221,4 @@ describe.each(stores)('A server using %s', (name, { storeUrn, setup, teardown })
|
|||||||
await fileHelper.deleteResource(fileId);
|
await fileHelper.deleteResource(fileId);
|
||||||
await fileHelper.shouldNotExist(fileId);
|
await fileHelper.shouldNotExist(fileId);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
@ -2,8 +2,7 @@ import type { HttpHandler, Initializer, ResourceStore } from '../../src/';
|
|||||||
import { describeIf, FileTestHelper } from '../util/TestHelpers';
|
import { describeIf, FileTestHelper } from '../util/TestHelpers';
|
||||||
import { BASE, instantiateFromConfig } from './Config';
|
import { BASE, instantiateFromConfig } from './Config';
|
||||||
|
|
||||||
describeIf('docker', 'a server with a SPARQL endpoint as storage', (): void => {
|
describeIf('docker', 'A server with a SPARQL endpoint as storage', (): void => {
|
||||||
describe('without acl', (): void => {
|
|
||||||
let handler: HttpHandler;
|
let handler: HttpHandler;
|
||||||
let fileHelper: FileTestHelper;
|
let fileHelper: FileTestHelper;
|
||||||
|
|
||||||
@ -41,5 +40,4 @@ describeIf('docker', 'a server with a SPARQL endpoint as storage', (): void => {
|
|||||||
const id = response._getHeaders().location;
|
const id = response._getHeaders().location;
|
||||||
expect(id).toBeTruthy();
|
expect(id).toBeTruthy();
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user