mirror of
https://github.com/logos-storage/logos-storage-js.git
synced 2026-01-05 23:13:07 +00:00
Update tests
This commit is contained in:
parent
4fcf34a136
commit
a05672ff7f
@ -52,15 +52,15 @@ describe("marketplace", async () => {
|
||||
const errors: Partial<CodexCreateAvailabilityInput>[] = [
|
||||
{ duration: 0 },
|
||||
{ totalSize: 0 },
|
||||
{ totalCollateral: BigInt(-1) },
|
||||
{ minPricePerBytePerSecond: BigInt(-1) },
|
||||
{ totalCollateral: -1 },
|
||||
{ minPricePerBytePerSecond: -1 },
|
||||
];
|
||||
|
||||
for (const err of errors) {
|
||||
const field = Object.keys(err)[0] as keyof typeof err;
|
||||
assert.ok(field);
|
||||
|
||||
it(`fails to create availability with wrong ${field}`, async () => {
|
||||
it(`fails to create availability with wrong ${field} = ${err[field]}`, async () => {
|
||||
const response = await spMarketplace.createAvailability({
|
||||
...body,
|
||||
[field]: err[field],
|
||||
@ -73,9 +73,7 @@ describe("marketplace", async () => {
|
||||
response.data.errors[0]?.received,
|
||||
err[field]?.toString()
|
||||
);
|
||||
assert.ok(
|
||||
response.data.errors[0]?.message.startsWith("Invalid value:")
|
||||
);
|
||||
assert.ok(response.data.errors[0]?.message.startsWith("Invalid"));
|
||||
});
|
||||
}
|
||||
});
|
||||
@ -137,9 +135,7 @@ describe("marketplace", async () => {
|
||||
response.data.errors[0]?.received,
|
||||
err[field]?.toString()
|
||||
);
|
||||
assert.ok(
|
||||
response.data.errors[0]?.message.startsWith("Invalid value:")
|
||||
);
|
||||
assert.ok(response.data.errors[0]?.message.startsWith("Invalid"));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@ -42,7 +42,7 @@ export const CodexCreateAvailabilityInput = v.strictObject({
|
||||
totalSize: v.pipe(v.number(), v.minValue(1)),
|
||||
duration: v.pipe(v.number(), v.minValue(1)),
|
||||
minPricePerBytePerSecond: v.union([
|
||||
v.bigint(),
|
||||
v.pipe(v.bigint(), v.minValue(BigInt(0))),
|
||||
v.pipe(
|
||||
v.number(),
|
||||
v.minValue(0),
|
||||
@ -50,7 +50,7 @@ export const CodexCreateAvailabilityInput = v.strictObject({
|
||||
),
|
||||
]),
|
||||
totalCollateral: v.union([
|
||||
v.bigint(),
|
||||
v.pipe(v.bigint(), v.minValue(BigInt(0))),
|
||||
v.pipe(
|
||||
v.number(),
|
||||
v.minValue(0),
|
||||
@ -85,17 +85,17 @@ export const CodexAvailabilityPatchInput = v.strictObject({
|
||||
duration: v.optional(v.pipe(v.number(), v.minValue(1))),
|
||||
minPricePerBytePerSecond: v.optional(
|
||||
v.union([
|
||||
v.bigint(),
|
||||
v.pipe(v.bigint(), v.minValue(BigInt(0))),
|
||||
v.pipe(
|
||||
v.number(),
|
||||
v.minValue(1),
|
||||
v.minValue(0),
|
||||
v.transform((input) => BigInt(input))
|
||||
),
|
||||
])
|
||||
),
|
||||
totalCollateral: v.optional(
|
||||
v.union([
|
||||
v.bigint(),
|
||||
v.pipe(v.bigint(), v.minValue(BigInt(0))),
|
||||
v.pipe(
|
||||
v.number(),
|
||||
v.minValue(0),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user