Skip to content

Commit f5b1a4b

Browse files
committed
Support timezones
1 parent 84024c6 commit f5b1a4b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,9 @@ export default class GitHubDriver {
5454
}
5555

5656
#validateLabels(labels) {
57+
const maxLength = 50;
5758
labels.forEach((label) => {
58-
if (label.length > 51) throw new Error(`Label '${label}' is longer than the GitHub max length of 51 characters`);
59+
if (label.length > maxLength) throw new Error(`Label '${label}' is longer than the GitHub max length of ${maxLength} characters`);
5960
});
6061
}
6162
}

test/index.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,33 +85,33 @@ describe('driver', () => {
8585
eq(labels[3], 'l2');
8686
});
8787

88-
it('should reject reminders with labels greater than 51 characters', async (t) => {
88+
it('should reject reminders with labels greater than 50 characters', async (t) => {
8989
const repository = { owner: 'acuminous', name: 'knuff-github-driver' };
9090
const reminder = {
9191
id: `test-${crypto.randomBytes(10).toString('hex')}`,
9292
title: t.name,
9393
body: 'the body',
94-
labels: ['123456789 123456789 123456789 123456789 123456789 12'],
94+
labels: ['123456789 123456789 123456789 123456789 123456789 1'],
9595
date: new Date('2024-12-25'),
9696
};
9797

9898
await rejects(() => driver.createReminder(repository, reminder), (error) => {
99-
eq(error.message, "Label '123456789 123456789 123456789 123456789 123456789 12' is longer than the GitHub max length of 51 characters");
99+
eq(error.message, "Label '123456789 123456789 123456789 123456789 123456789 1' is longer than the GitHub max length of 50 characters");
100100
return true;
101101
});
102102
});
103103

104104
it('should reject reminders with an id greater than 46 characters', async (t) => {
105105
const repository = { owner: 'acuminous', name: 'knuff-github-driver' };
106106
const reminder = {
107-
id: '123456789 123456789 123456789 123456789 123456',
107+
id: '123456789 123456789 123456789 123456789 12345',
108108
title: t.name,
109109
body: 'the body',
110110
date: new Date('2024-12-25'),
111111
};
112112

113113
await rejects(() => driver.createReminder(repository, reminder), (error) => {
114-
eq(error.message, "Label 'knuff:123456789 123456789 123456789 123456789 123456' is longer than the GitHub max length of 51 characters");
114+
eq(error.message, "Label 'knuff:123456789 123456789 123456789 123456789 12345' is longer than the GitHub max length of 50 characters");
115115
return true;
116116
});
117117
});

0 commit comments

Comments
 (0)