Skip to content

Commit ee344f6

Browse files
committed
Tests n Stuff
1 parent 5f00f8d commit ee344f6

6 files changed

Lines changed: 112 additions & 112 deletions

File tree

‎app/Http/Controllers/ComputerScienceResourceController.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function store(StoreResourceRequest $request)
122122
'platforms' => $resource->platforms,
123123
]);
124124

125-
$request->session()->flash('success', 'Created Resource!');
125+
session()->flash('success', 'Created Resource!');
126126

127127
return response()->json($resource);
128128
} catch (Throwable $e) {

‎resources/js/Components/Comments/Commentable.vue‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ provide("createdNewCommentCallback", createdNewCommentCallback);
8080
provide("commentRefs", commentRefs);
8181
8282
const showEmptyState = computed(() => {
83-
return (
84-
hasLoadedCommentData &&
85-
(!idToChildren.value ||
86-
!(idToChildren.value instanceof Map) ||
87-
!idToChildren.value.get(null) ||
88-
idToChildren.value.get(null).length === 0)
89-
);
83+
const data = idToChildren.value;
84+
let topLevel = [];
85+
86+
// Handle both Map and plain object shapes
87+
if (data && typeof data.get === "function") {
88+
topLevel = data.get(null) || [];
89+
} else if (data && typeof data === "object") {
90+
topLevel = data[null] || data["null"] || [];
91+
}
92+
93+
return topLevel.length === 0;
9094
});
9195
9296
function updateUsers(newUsers) {

‎resources/js/Components/Resources/SubmissionGuidelines.vue‎

Lines changed: 93 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -1,107 +1,101 @@
11
<template>
2-
<div
3-
class="bg-gray-50 border border-gray-200 rounded-lg p-6 w-full md:w-[28vw] min-w-[20rem] h-fit sticky md:top-8 mt-0 md:mb-0"
4-
>
5-
<h3 class="text-lg font-semibold mb-4 text-gray-800">
6-
Submission Guidelines
7-
</h3>
2+
<h3 class="text-lg font-semibold mb-4 text-gray-800">
3+
Submission Guidelines
4+
</h3>
5+
<div class="space-y-4 text-sm text-gray-700">
86
<div class="space-y-4 text-sm text-gray-700">
9-
<div class="space-y-4 text-sm text-gray-700">
10-
<div>
11-
<h4 class="font-bold text-gray-800 mb-2">Resource Scope</h4>
12-
<p class="mb-2">
13-
This site features comprehensive learning resources
14-
rather than isolated materials. Resources should provide
15-
ongoing value or structured learning experiences rather
16-
than a single-use reference.
17-
</p>
18-
<p>
19-
Our goal is to provide ways for developers to hone their
20-
skills. This industry is filled with passion, so we
21-
should make it easier to find more ways to learn.
22-
</p>
23-
</div>
7+
<div>
8+
<h4 class="font-bold text-gray-800 mb-2">Resource Scope</h4>
9+
<p class="mb-2">
10+
This site features comprehensive learning resources rather
11+
than isolated materials. Resources should provide ongoing
12+
value or structured learning experiences rather than a
13+
single-use reference.
14+
</p>
15+
<p>
16+
Our goal is to provide ways for developers to hone their
17+
skills. This industry is filled with passion, so we should
18+
make it easier to find more ways to learn.
19+
</p>
20+
</div>
2421

25-
<div>
26-
<h4 class="font-bold text-gray-800 mb-2">
27-
Types of Content Accepted
28-
</h4>
29-
<ul class="list-disc list-inside space-y-1 text-xs">
30-
<li>
31-
Platforms, websites, and tools that offer
32-
interactive learning
33-
</li>
34-
<li>
35-
Collections of educational content, such as YouTube
36-
channels or book series
37-
</li>
38-
<li>
39-
Guides or repositories that serve as long-term
40-
learning hubs
41-
</li>
42-
<li>
43-
Newsletters that consistently release content to
44-
date
45-
</li>
46-
<li>
47-
Organizations that can provide software career
48-
advising
49-
</li>
50-
</ul>
51-
<p class="mt-2 text-xs">
52-
Anything to help people learn more about software: from
53-
hardware, system design, to project management. The more
54-
specialized the resources are, the better.
55-
</p>
56-
</div>
22+
<div>
23+
<h4 class="font-bold text-gray-800 mb-2">
24+
Types of Content Accepted
25+
</h4>
26+
<ul class="list-disc list-inside space-y-1 text-xs">
27+
<li>
28+
Platforms, websites, and tools that offer interactive
29+
learning
30+
</li>
31+
<li>
32+
Collections of educational content, such as YouTube
33+
channels or book series
34+
</li>
35+
<li>
36+
Guides or repositories that serve as long-term learning
37+
hubs
38+
</li>
39+
<li>
40+
Newsletters that consistently release content to date
41+
</li>
42+
<li>
43+
Organizations that can provide software career advising
44+
</li>
45+
</ul>
46+
<p class="mt-2 text-xs">
47+
Anything to help people learn more about software: from
48+
hardware, system design, to project management. The more
49+
specialized the resources are, the better.
50+
</p>
51+
</div>
5752

58-
<div>
59-
<h4 class="font-bold text-gray-800 mb-2">Exceptions</h4>
60-
<ul class="list-disc list-inside space-y-1 text-xs">
61-
<li>
62-
An individual book may be included if it is
63-
exceptionally well-regarded and widely recommended
64-
as a foundational resource
65-
</li>
66-
<li>
67-
Entertainment streamers and YouTubers can be
68-
included given that they are very popular whilst
69-
still informative
70-
</li>
71-
<li>
72-
Do not post your paid courses unless they are well
73-
received - this is not a platform to advertise
74-
unwanted courses
75-
</li>
76-
</ul>
77-
</div>
53+
<div>
54+
<h4 class="font-bold text-gray-800 mb-2">Exceptions</h4>
55+
<ul class="list-disc list-inside space-y-1 text-xs">
56+
<li>
57+
An individual book may be included if it is
58+
exceptionally well-regarded and widely recommended as a
59+
foundational resource
60+
</li>
61+
<li>
62+
Entertainment streamers and YouTubers can be included
63+
given that they are very popular whilst still
64+
informative
65+
</li>
66+
<li>
67+
Do not post your paid courses unless they are well
68+
received - this is not a platform to advertise unwanted
69+
courses
70+
</li>
71+
</ul>
72+
</div>
7873

79-
<div>
80-
<h4 class="font-bold text-gray-800 mb-2">
81-
What's Not Included
82-
</h4>
83-
<ul class="list-disc list-inside space-y-1 text-xs">
84-
<li>
85-
Standalone videos, single blog posts, or one-off
86-
articles
87-
</li>
88-
<li>
89-
Resources that are too broad and do not contain a
90-
singular focus
91-
</li>
92-
<li>
93-
Things not related to learning about computer
94-
science or software engineering
95-
</li>
96-
<li>
97-
Lifestyle or personal finance content (beyond
98-
reasonable project management)
99-
</li>
100-
</ul>
101-
<p class="mt-2 text-xs italic">
102-
In the end, we trust you to be reasonable.
103-
</p>
104-
</div>
74+
<div>
75+
<h4 class="font-bold text-gray-800 mb-2">
76+
What's Not Included
77+
</h4>
78+
<ul class="list-disc list-inside space-y-1 text-xs">
79+
<li>
80+
Standalone videos, single blog posts, or one-off
81+
articles
82+
</li>
83+
<li>
84+
Resources that are too broad and do not contain a
85+
singular focus
86+
</li>
87+
<li>
88+
Things not related to learning about computer science or
89+
software engineering
90+
</li>
91+
<li>
92+
Lifestyle or personal finance content (beyond reasonable
93+
project management)
94+
</li>
95+
</ul>
96+
<p class="mt-2 text-xs italic">
97+
In the end, we trust you to be reasonable.
98+
</p>
10599
</div>
106100
</div>
107101
</div>

‎resources/js/Pages/Resources/Create.vue‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,11 @@ const handleFormChange = (newFormData) => {
115115
class="w-full flex flex-col md:flex-row gap-10 justify-center px-6 items-start"
116116
>
117117
<!-- Instructions Sidebar (Rules) -->
118-
<SubmissionGuidelines />
118+
<div
119+
class="bg-gray-50 border border-gray-200 rounded-lg p-6 w-full md:w-[28vw] min-w-[20rem] h-fit sticky md:top-8 mt-0 md:mb-0"
120+
>
121+
<SubmissionGuidelines />
122+
</div>
119123
<!-- Main Form Section -->
120124
<div
121125
ref="formRef"

‎tests/Feature/TagSearchTest.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ public function test_creating_resource_updates_tag_frequency()
6969

7070
$response = $this->postJson(route('resources.store'), $formData);
7171

72-
$response->assertStatus(302); // a redirect after successful creation
73-
$response->assertRedirect();
72+
$response->assertStatus(200);
7473

7574
// Check that TagFrequency reflects counts
7675
$this->assertDatabaseHas('tag_frequencies', ['tag' => 'python', 'count' => 2]);

‎tests/Feature/Utils/TestingUtils.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,7 @@ public function approveResourceEdit(ResourceEdits $edit)
7878

7979
// Merge the edit
8080
$mergeResponse = $this->post(route('resource_edits.merge', ['resourceEdits' => $edit->id]));
81-
$mergeResponse
82-
->assertRedirect(route('resources.show', ['slug' => $edit->resource->slug]));
81+
$mergeResponse ->assertRedirect();
8382
}
8483

8584
public function createComment(string $commentableKey, int $commentableId, array $overrides = [])

0 commit comments

Comments
 (0)