Skip to content

Commit 1a04021

Browse files
fullstackjamclaude
andcommitted
fix: update config endpoint tests for shell removal and cask dedup
Tests were not updated when shell was removed from config API responses and packages/casks deduplication logic was fixed in 96760a4. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 96760a4 commit 1a04021

File tree

1 file changed

+5
-82
lines changed

1 file changed

+5
-82
lines changed

src/routes/[username]/[slug]/config/server.test.ts

Lines changed: 5 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ describe('[username]/[slug]/config GET - Visibility Auth', () => {
222222

223223
const json = await getJSON(response);
224224
expect(json.packages).toContain('git');
225-
expect(json.packages).toContain('visual-studio-code');
225+
expect(json.packages).not.toContain('visual-studio-code');
226226
expect(json.casks).toContain('visual-studio-code');
227227
expect(json.npm).toContain('typescript');
228228
});
@@ -264,7 +264,7 @@ describe('[username]/[slug]/config GET - Visibility Auth', () => {
264264
expect(json.taps).toContain('homebrew/cask-fonts');
265265
});
266266

267-
it('should parse shell config from snapshot', async () => {
267+
it('should not include shell in API response', async () => {
268268
const config = {
269269
...mockPublicConfig,
270270
snapshot: JSON.stringify({
@@ -300,84 +300,7 @@ describe('[username]/[slug]/config GET - Visibility Auth', () => {
300300
});
301301

302302
const json = await getJSON(response);
303-
expect(json.shell).toEqual({
304-
oh_my_zsh: true,
305-
theme: 'powerlevel10k',
306-
plugins: ['git', 'zsh-autosuggestions']
307-
});
308-
});
309-
310-
it('should default shell fields when partially present', async () => {
311-
const config = {
312-
...mockPublicConfig,
313-
snapshot: JSON.stringify({
314-
packages: { taps: [], casks: [] },
315-
shell: { oh_my_zsh: true }
316-
})
317-
};
318-
319-
const db = createMockDB({
320-
users: [mockUser],
321-
configs: [config]
322-
});
323-
324-
const request = createMockRequest({ url: baseUrl });
325-
const platform = createMockPlatform(db);
326-
327-
const response = await GET({
328-
request,
329-
platform,
330-
params: { username: 'testuser', slug: 'public-config' },
331-
url: new URL(baseUrl),
332-
route: { id: '/[username]/[slug]/config' },
333-
locals: {},
334-
isDataRequest: false,
335-
isSubRequest: false,
336-
cookies: {} as any,
337-
getClientAddress: () => '',
338-
fetch: globalThis.fetch
339-
});
340-
341-
const json = await getJSON(response);
342-
expect(json.shell).toEqual({
343-
oh_my_zsh: true,
344-
theme: '',
345-
plugins: []
346-
});
347-
});
348-
349-
it('should return null shell when snapshot has no shell', async () => {
350-
const config = {
351-
...mockPublicConfig,
352-
snapshot: JSON.stringify({
353-
packages: { taps: [], casks: [] }
354-
})
355-
};
356-
357-
const db = createMockDB({
358-
users: [mockUser],
359-
configs: [config]
360-
});
361-
362-
const request = createMockRequest({ url: baseUrl });
363-
const platform = createMockPlatform(db);
364-
365-
const response = await GET({
366-
request,
367-
platform,
368-
params: { username: 'testuser', slug: 'public-config' },
369-
url: new URL(baseUrl),
370-
route: { id: '/[username]/[slug]/config' },
371-
locals: {},
372-
isDataRequest: false,
373-
isSubRequest: false,
374-
cookies: {} as any,
375-
getClientAddress: () => '',
376-
fetch: globalThis.fetch
377-
});
378-
379-
const json = await getJSON(response);
380-
expect(json.shell).toBeNull();
303+
expect(json.shell).toBeUndefined();
381304
});
382305

383306
it('should parse macos_prefs from snapshot', async () => {
@@ -526,7 +449,7 @@ describe('[username]/[slug]/config GET - Visibility Auth', () => {
526449

527450
expect(response.status).toBe(200);
528451
const json = await getJSON(response);
529-
expect(json.shell).toBeNull();
452+
expect(json.shell).toBeUndefined();
530453
expect(json.macos_prefs).toBeNull();
531454
});
532455

@@ -562,7 +485,7 @@ describe('[username]/[slug]/config GET - Visibility Auth', () => {
562485
});
563486

564487
const json = await getJSON(response);
565-
expect(json.packages).toEqual(['git', 'curl', 'wget']);
488+
expect(json.packages).toEqual(['git', 'wget']);
566489
expect(json.casks).toContain('curl');
567490
});
568491

0 commit comments

Comments
 (0)