Release Privacy Tools 0.1.0
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
assertBatchFiles,
|
||||
PrivacyLimitError,
|
||||
resolveLimits,
|
||||
} from "../../src/privacy";
|
||||
|
||||
describe("privacy resource limits", () => {
|
||||
it("rejects too many, oversized and collectively oversized files", () => {
|
||||
expect(() =>
|
||||
assertBatchFiles([{ size: 1 }, { size: 1 }], {
|
||||
...resolveLimits(),
|
||||
maxFiles: 1,
|
||||
}),
|
||||
).toThrow(PrivacyLimitError);
|
||||
expect(() =>
|
||||
assertBatchFiles([{ size: 11 }], {
|
||||
...resolveLimits(),
|
||||
maxFileBytes: 10,
|
||||
}),
|
||||
).toThrow(PrivacyLimitError);
|
||||
expect(() =>
|
||||
assertBatchFiles([{ size: 6 }, { size: 6 }], {
|
||||
...resolveLimits(),
|
||||
maxFileBytes: 10,
|
||||
maxBatchBytes: 10,
|
||||
}),
|
||||
).toThrow(PrivacyLimitError);
|
||||
});
|
||||
|
||||
it("rejects invalid limit overrides", () => {
|
||||
expect(() => resolveLimits({ maxFiles: 0 })).toThrow(
|
||||
/positive safe integer/iu,
|
||||
);
|
||||
expect(() => resolveLimits({ maxFileBytes: Number.NaN })).toThrow(
|
||||
/positive safe integer/iu,
|
||||
);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user