Add biome and initial format rules

This commit is contained in:
Nick Cipollo
2025-02-17 16:15:54 -05:00
parent 33bf18d283
commit 17b559883e
37 changed files with 3110 additions and 975 deletions

View File

@@ -1,22 +1,21 @@
import {Artifact} from "../src/Artifact"
import {GithubArtifactUploader} from "../src/ArtifactUploader"
import {Releases} from "../src/Releases";
import {RequestError} from '@octokit/request-error'
import {GithubArtifactDestroyer} from "../src/ArtifactDestroyer";
import { Artifact } from "../src/Artifact"
import { GithubArtifactUploader } from "../src/ArtifactUploader"
import { Releases } from "../src/Releases"
import { RequestError } from "@octokit/request-error"
import { GithubArtifactDestroyer } from "../src/ArtifactDestroyer"
const releaseId = 100
const deleteMock = jest.fn()
const listArtifactsMock = jest.fn()
describe('ArtifactDestroyer', () => {
describe("ArtifactDestroyer", () => {
beforeEach(() => {
deleteMock.mockClear()
listArtifactsMock.mockClear()
})
it('destroys all artifacts', async () => {
it("destroys all artifacts", async () => {
mockListWithAssets()
mockDeleteSuccess()
const destroyer = createDestroyer()
@@ -26,7 +25,7 @@ describe('ArtifactDestroyer', () => {
expect(deleteMock).toBeCalledTimes(2)
})
it('destroys nothing when no artifacts found', async () => {
it("destroys nothing when no artifacts found", async () => {
mockListWithoutAssets()
const destroyer = createDestroyer()
@@ -35,11 +34,11 @@ describe('ArtifactDestroyer', () => {
expect(deleteMock).toBeCalledTimes(0)
})
it('throws when delete call fails', async () => {
it("throws when delete call fails", async () => {
mockListWithAssets()
mockDeleteError()
const destroyer = createDestroyer()
expect.hasAssertions()
try {
await destroyer.destroyArtifacts(releaseId)
@@ -57,7 +56,7 @@ describe('ArtifactDestroyer', () => {
listArtifactsForRelease: listArtifactsMock,
listReleases: jest.fn(),
update: jest.fn(),
uploadArtifact: jest.fn()
uploadArtifact: jest.fn(),
}
})
return new GithubArtifactDestroyer(new MockReleases())
@@ -75,16 +74,16 @@ describe('ArtifactDestroyer', () => {
listArtifactsMock.mockResolvedValue([
{
name: "art1",
id: 1
id: 1,
},
{
name: "art2",
id: 2
}
id: 2,
},
])
}
function mockListWithoutAssets() {
listArtifactsMock.mockResolvedValue([])
}
});
})