chore: migrate to oxlint and oxfmt
Co-authored-by: Christoph Nakazawa <christoph.pojer@gmail.com>
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
DEFAULT_HEARTBEAT_ACK_MAX_CHARS,
|
||||
stripHeartbeatToken,
|
||||
} from "./heartbeat.js";
|
||||
import { DEFAULT_HEARTBEAT_ACK_MAX_CHARS, stripHeartbeatToken } from "./heartbeat.js";
|
||||
import { HEARTBEAT_TOKEN } from "./tokens.js";
|
||||
|
||||
describe("stripHeartbeatToken", () => {
|
||||
@@ -18,26 +15,20 @@ describe("stripHeartbeatToken", () => {
|
||||
text: "",
|
||||
didStrip: false,
|
||||
});
|
||||
expect(stripHeartbeatToken(HEARTBEAT_TOKEN, { mode: "heartbeat" })).toEqual(
|
||||
{
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
it("drops heartbeats with small junk in heartbeat mode", () => {
|
||||
expect(
|
||||
stripHeartbeatToken("HEARTBEAT_OK 🦞", { mode: "heartbeat" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(HEARTBEAT_TOKEN, { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
});
|
||||
expect(
|
||||
stripHeartbeatToken(`🦞 ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" }),
|
||||
).toEqual({
|
||||
});
|
||||
|
||||
it("drops heartbeats with small junk in heartbeat mode", () => {
|
||||
expect(stripHeartbeatToken("HEARTBEAT_OK 🦞", { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
});
|
||||
expect(stripHeartbeatToken(`🦞 ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
@@ -45,9 +36,7 @@ describe("stripHeartbeatToken", () => {
|
||||
});
|
||||
|
||||
it("drops short remainder in heartbeat mode", () => {
|
||||
expect(
|
||||
stripHeartbeatToken(`ALERT ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(`ALERT ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
@@ -56,9 +45,7 @@ describe("stripHeartbeatToken", () => {
|
||||
|
||||
it("keeps heartbeat replies when remaining content exceeds threshold", () => {
|
||||
const long = "A".repeat(DEFAULT_HEARTBEAT_ACK_MAX_CHARS + 1);
|
||||
expect(
|
||||
stripHeartbeatToken(`${long} ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(`${long} ${HEARTBEAT_TOKEN}`, { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: false,
|
||||
text: long,
|
||||
didStrip: true,
|
||||
@@ -66,16 +53,12 @@ describe("stripHeartbeatToken", () => {
|
||||
});
|
||||
|
||||
it("strips token at edges for normal messages", () => {
|
||||
expect(
|
||||
stripHeartbeatToken(`${HEARTBEAT_TOKEN} hello`, { mode: "message" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(`${HEARTBEAT_TOKEN} hello`, { mode: "message" })).toEqual({
|
||||
shouldSkip: false,
|
||||
text: "hello",
|
||||
didStrip: true,
|
||||
});
|
||||
expect(
|
||||
stripHeartbeatToken(`hello ${HEARTBEAT_TOKEN}`, { mode: "message" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(`hello ${HEARTBEAT_TOKEN}`, { mode: "message" })).toEqual({
|
||||
shouldSkip: false,
|
||||
text: "hello",
|
||||
didStrip: true,
|
||||
@@ -95,9 +78,7 @@ describe("stripHeartbeatToken", () => {
|
||||
});
|
||||
|
||||
it("strips HTML-wrapped heartbeat tokens", () => {
|
||||
expect(
|
||||
stripHeartbeatToken(`<b>${HEARTBEAT_TOKEN}</b>`, { mode: "heartbeat" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(`<b>${HEARTBEAT_TOKEN}</b>`, { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
@@ -105,9 +86,7 @@ describe("stripHeartbeatToken", () => {
|
||||
});
|
||||
|
||||
it("strips markdown-wrapped heartbeat tokens", () => {
|
||||
expect(
|
||||
stripHeartbeatToken(`**${HEARTBEAT_TOKEN}**`, { mode: "heartbeat" }),
|
||||
).toEqual({
|
||||
expect(stripHeartbeatToken(`**${HEARTBEAT_TOKEN}**`, { mode: "heartbeat" })).toEqual({
|
||||
shouldSkip: true,
|
||||
text: "",
|
||||
didStrip: true,
|
||||
|
||||
Reference in New Issue
Block a user