Skip to content

Commit 23f9042

Browse files
committed
fix: add eof to sequences
1 parent 5bcf04c commit 23f9042

File tree

4 files changed

+84
-10
lines changed

4 files changed

+84
-10
lines changed

src/generators/sequences.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,49 @@ export const sequences = createLoom({
2020
template: (ctx, item) => {
2121
return `${item.codePoints.join(" ")} ${ctx.options.separator} ${item.type} ${ctx.options.separator} ${item.description} ${ctx.options.commentPrefix} ${item.comment}`;
2222
},
23+
eof: true,
24+
presets: {
25+
basicEmojis: [
26+
{
27+
codePoints: ["1F600"],
28+
type: "emoji",
29+
description: "grinning face",
30+
comment: "basic smiley",
31+
},
32+
{
33+
codePoints: ["1F601"],
34+
type: "emoji",
35+
description: "beaming face with smiling eyes",
36+
comment: "happy expression",
37+
},
38+
],
39+
handGestures: [
40+
{
41+
codePoints: ["1F44D"],
42+
type: "emoji",
43+
description: "thumbs up",
44+
comment: "positive gesture",
45+
},
46+
{
47+
codePoints: ["1F44C"],
48+
type: "emoji",
49+
description: "OK hand",
50+
comment: "approval gesture",
51+
},
52+
],
53+
hearts: [
54+
{
55+
codePoints: ["2764"],
56+
type: "emoji",
57+
description: "red heart",
58+
comment: "classic heart",
59+
},
60+
{
61+
codePoints: ["1F49B"],
62+
type: "emoji",
63+
description: "yellow heart",
64+
comment: "friendship heart",
65+
},
66+
],
67+
},
2368
});

src/generators/zwj-sequences.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ export const zwjSequences = createLoom({
2020
template: (ctx, item) => {
2121
return `${item.codePoints.join(" ")} ${ctx.options.separator} ${item.type} ${ctx.options.separator} ${item.description} ${ctx.options.commentPrefix} ${item.comment}`;
2222
},
23+
eof: true,
2324
});

test/sequences.test.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ describe("sequences", () => {
1717
};
1818

1919
const result = sequences({ ...defaultOptions, input: [input] });
20-
expect(result).toBe("1F600 1F601 | emoji | smiling face # happy expression");
20+
expect(result).toBe(
21+
"1F600 1F601 | emoji | smiling face # happy expression\n"
22+
+ "#EOF\n",
23+
);
2124
});
2225

2326
it("should handle single code point", () => {
@@ -29,7 +32,10 @@ describe("sequences", () => {
2932
};
3033

3134
const result = sequences({ ...defaultOptions, input: [input] });
32-
expect(result).toBe("1F600 | emoji | smiling face # happy expression");
35+
expect(result).toBe(
36+
"1F600 | emoji | smiling face # happy expression\n"
37+
+ "#EOF\n",
38+
);
3339
});
3440

3541
it("should use custom separator and comment prefix", () => {
@@ -47,7 +53,10 @@ describe("sequences", () => {
4753
};
4854

4955
const result = sequences({ ...options, input: [input] });
50-
expect(result).toBe("1F600 -> emoji -> smiling face // happy expression");
56+
expect(result).toBe(
57+
"1F600 -> emoji -> smiling face // happy expression\n"
58+
+ "#EOF\n",
59+
);
5160
});
5261

5362
it("should validate input schema", () => {
@@ -98,7 +107,10 @@ describe("sequences", () => {
98107
};
99108

100109
const result = sequences({ ...defaultOptions, input: [input] });
101-
expect(result).toBe(" | emoji | smiling face # happy expression");
110+
expect(result).toBe(
111+
" | emoji | smiling face # happy expression\n"
112+
+ "#EOF\n",
113+
);
102114
});
103115

104116
it("should handle multiple inputs", () => {
@@ -119,7 +131,9 @@ describe("sequences", () => {
119131

120132
const result = sequences({ ...defaultOptions, input: inputs });
121133
expect(result).toBe(
122-
"1F600 | emoji | smiling face # happy expression\n1F601 | emoji | grinning face # very happy",
134+
"1F600 | emoji | smiling face # happy expression\n"
135+
+ "1F601 | emoji | grinning face # very happy\n"
136+
+ "#EOF\n",
123137
);
124138
});
125139
});

test/zwj-sequences.test.ts

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ describe("zwj-sequences", () => {
1717
};
1818

1919
const result = zwjSequences({ ...defaultOptions, input: [input] });
20-
expect(result).toBe("1F600 1F601 | emoji | smiling face # happy expression");
20+
expect(result).toBe(
21+
"1F600 1F601 | emoji | smiling face # happy expression\n"
22+
+ "#EOF\n",
23+
);
2124
});
2225

2326
it("should handle single code point", () => {
@@ -29,7 +32,10 @@ describe("zwj-sequences", () => {
2932
};
3033

3134
const result = zwjSequences({ ...defaultOptions, input: [input] });
32-
expect(result).toBe("1F600 | emoji | smiling face # happy expression");
35+
expect(result).toBe(
36+
"1F600 | emoji | smiling face # happy expression\n"
37+
+ "#EOF\n",
38+
);
3339
});
3440

3541
it("should use custom separator and comment prefix", () => {
@@ -47,7 +53,10 @@ describe("zwj-sequences", () => {
4753
};
4854

4955
const result = zwjSequences({ ...options, input: [input] });
50-
expect(result).toBe("1F600 -> emoji -> smiling face // happy expression");
56+
expect(result).toBe(
57+
"1F600 -> emoji -> smiling face // happy expression\n"
58+
+ "#EOF\n",
59+
);
5160
});
5261

5362
it("should validate input schema", () => {
@@ -98,7 +107,10 @@ describe("zwj-sequences", () => {
98107
};
99108

100109
const result = zwjSequences({ ...defaultOptions, input: [input] });
101-
expect(result).toBe(" | emoji | smiling face # happy expression");
110+
expect(result).toBe(
111+
" | emoji | smiling face # happy expression\n"
112+
+ "#EOF\n",
113+
);
102114
});
103115

104116
it("should handle multiple inputs", () => {
@@ -119,7 +131,9 @@ describe("zwj-sequences", () => {
119131

120132
const result = zwjSequences({ ...defaultOptions, input: inputs });
121133
expect(result).toBe(
122-
"1F600 | emoji | smiling face # happy expression\n1F601 | emoji | grinning face # very happy",
134+
"1F600 | emoji | smiling face # happy expression\n"
135+
+ "1F601 | emoji | grinning face # very happy\n"
136+
+ "#EOF\n",
123137
);
124138
});
125139
});

0 commit comments

Comments
 (0)