Spaces:
Sleeping
Sleeping
File size: 974 Bytes
19e88d2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | import { it, describe, expect } from "vitest";
import { TEST_HUB_URL, TEST_ACCESS_TOKEN, TEST_USER } from "../test/consts";
import { createCollection } from "./create-collection";
import { deleteCollection } from "./delete-collection";
describe("createCollection", () => {
it("should create a collection", async () => {
let slug: string = "";
const randomString = crypto.randomUUID();
const title = `Test Collection ${randomString}`;
try {
const result = await createCollection({
collection: {
title,
namespace: TEST_USER,
description: "This is a test collection",
private: false,
},
accessToken: TEST_ACCESS_TOKEN,
hubUrl: TEST_HUB_URL,
});
expect(result.slug.startsWith(`${TEST_USER}/test-collection-${randomString}`)).toBe(true);
slug = result.slug;
} finally {
if (slug) {
await deleteCollection({
slug,
accessToken: TEST_ACCESS_TOKEN,
hubUrl: TEST_HUB_URL,
});
}
}
});
});
|