mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-20 03:26:47 +08:00
refactor(server): rate limit and permission (#4198)
Co-authored-by: LongYinan <lynweklm@gmail.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import request from 'supertest';
|
||||
|
||||
import { AppModule } from '../app';
|
||||
import {
|
||||
checkBlobSize,
|
||||
collectAllBlobSizes,
|
||||
collectBlobSizes,
|
||||
createWorkspace,
|
||||
@@ -126,4 +127,20 @@ test('should calc all blobs size', async t => {
|
||||
|
||||
const size = await collectAllBlobSizes(app, u1.token.token);
|
||||
t.is(size, 8, 'failed to collect all blob sizes');
|
||||
|
||||
const size1 = await checkBlobSize(
|
||||
app,
|
||||
u1.token.token,
|
||||
workspace1.id,
|
||||
10 * 1024 * 1024 * 1024 - 8
|
||||
);
|
||||
t.is(size1, 0, 'failed to check blob size');
|
||||
|
||||
const size2 = await checkBlobSize(
|
||||
app,
|
||||
u1.token.token,
|
||||
workspace1.id,
|
||||
10 * 1024 * 1024 * 1024 - 7
|
||||
);
|
||||
t.is(size2, -1, 'failed to check blob size');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user