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 { GithubErrorDetail } from "../src/GithubErrorDetail"
describe('GithubErrorDetail', () => {
it('provides error code', () => {
describe("GithubErrorDetail", () => {
it("provides error code", () => {
const error = {
code: "missing"
code: "missing",
}
const detail = new GithubErrorDetail(error)
expect(detail.code).toBe('missing')
expect(detail.code).toBe("missing")
})
it('generates missing resource error message', () => {
it("generates missing resource error message", () => {
const resource = "release"
const error = {
code: "missing",
resource: resource
resource: resource,
}
const detail = new GithubErrorDetail(error)
@@ -25,13 +24,13 @@ describe('GithubErrorDetail', () => {
expect(message).toBe(`${resource} does not exist.`)
})
it('generates missing field error message', () => {
it("generates missing field error message", () => {
const resource = "release"
const field = "body"
const error = {
code: "missing_field",
field: field,
resource: resource
resource: resource,
}
const detail = new GithubErrorDetail(error)
@@ -40,13 +39,13 @@ describe('GithubErrorDetail', () => {
expect(message).toBe(`The ${field} field on ${resource} is missing.`)
})
it('generates invalid field error message', () => {
it("generates invalid field error message", () => {
const resource = "release"
const field = "body"
const error = {
code: "invalid",
field: field,
resource: resource
resource: resource,
}
const detail = new GithubErrorDetail(error)
@@ -55,11 +54,11 @@ describe('GithubErrorDetail', () => {
expect(message).toBe(`The ${field} field on ${resource} is an invalid format.`)
})
it('generates resource already exists error message', () => {
it("generates resource already exists error message", () => {
const resource = "release"
const error = {
code: "already_exists",
resource: resource
resource: resource,
}
const detail = new GithubErrorDetail(error)
@@ -68,13 +67,13 @@ describe('GithubErrorDetail', () => {
expect(message).toBe(`${resource} already exists.`)
})
describe('generates custom error message', () => {
it('with documentation url', () => {
describe("generates custom error message", () => {
it("with documentation url", () => {
const url = "https://api.example.com"
const error = {
code: "custom",
message: "foo",
documentation_url: url
documentation_url: url,
}
const detail = new GithubErrorDetail(error)
@@ -83,16 +82,16 @@ describe('GithubErrorDetail', () => {
expect(message).toBe(`foo\nPlease see ${url}.`)
})
it('without documentation url', () => {
it("without documentation url", () => {
const error = {
code: "custom",
message: "foo"
message: "foo",
}
const detail = new GithubErrorDetail(error)
const message = detail.toString()
expect(message).toBe('foo')
expect(message).toBe("foo")
})
})
})
})