Add feed validation and display
This commit is contained in:
@@ -310,6 +310,61 @@ describe("Tools", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("displayList", () => {
|
||||
it("should return an empty string when the list is empty", () => {
|
||||
const list = []
|
||||
const output = T.displayList(list)
|
||||
|
||||
expect(output).toEqual("")
|
||||
})
|
||||
|
||||
it("should return a single entry when list length is one", () => {
|
||||
const list = ["Apple"]
|
||||
const output = T.displayList(list)
|
||||
|
||||
expect(output).toEqual("Apple")
|
||||
})
|
||||
|
||||
it("should return a string of both items when the list length is two", () => {
|
||||
const list = ["Apple", "Banana"]
|
||||
const output = T.displayList(list)
|
||||
|
||||
expect(output).toEqual("Apple and Banana")
|
||||
})
|
||||
|
||||
it("should return a string of all items when the list length is three", () => {
|
||||
const list = ["Apple", "Banana", "Cherry"]
|
||||
const output = T.displayList(list)
|
||||
|
||||
expect(output).toEqual("Apple, Banana, and Cherry")
|
||||
})
|
||||
|
||||
it("should return a truncated string of all items when the list is long", () => {
|
||||
const list = [
|
||||
"Apple",
|
||||
"Banana",
|
||||
"Orange",
|
||||
"Pear",
|
||||
"Grapes",
|
||||
"Mango",
|
||||
"Pineapple",
|
||||
"Kiwi",
|
||||
"Strawberry",
|
||||
"Blueberry",
|
||||
]
|
||||
const output = T.displayList(list)
|
||||
|
||||
expect(output).toEqual("Apple, Banana, Orange, Pear, Grapes, Mango, and 4 others")
|
||||
})
|
||||
|
||||
it("should return a string of both items with list of two numbers", () => {
|
||||
const list = [7, 17]
|
||||
const output = T.displayList(list)
|
||||
|
||||
expect(output).toEqual("7 and 17")
|
||||
})
|
||||
})
|
||||
|
||||
describe("Collection Operations", () => {
|
||||
it("should handle group operations", () => {
|
||||
const items = [
|
||||
|
||||
Reference in New Issue
Block a user