Skip to content

Commit c8c3f2f

Browse files
committed
🚨 Revert tests for authorship (#2446)
1 parent 2993de2 commit c8c3f2f

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/test/lib/utils/authorship.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ describe('Logged-in user id', () => {
152152
const testCases = [
153153
{ isPublished: false, userId: adminId, authorId: adminId },
154154
{ isPublished: false, userId: userId1, authorId: userId1 },
155+
{ isPublished: false, userId: userId2, authorId: userId2 },
155156
];
156157
runTests('canRead', testCases, ({ isPublished, userId, authorId }: AuthorshipForRead) => {
157158
expect(canRead(isPublished, userId, authorId)).toBe(true);
@@ -160,9 +161,12 @@ describe('Logged-in user id', () => {
160161

161162
describe('and the user is not the author', () => {
162163
const testCases = [
163-
{ isPublished: false, userId: adminId, authorId: userId1 },
164164
{ isPublished: false, userId: userId1, authorId: adminId },
165+
{ isPublished: false, userId: userId2, authorId: adminId },
166+
{ isPublished: false, userId: adminId, authorId: userId1 },
167+
{ isPublished: false, userId: adminId, authorId: userId2 },
165168
{ isPublished: false, userId: userId1, authorId: userId2 },
169+
{ isPublished: false, userId: userId2, authorId: userId1 },
166170
];
167171
runTests('canRead', testCases, ({ isPublished, userId, authorId }: AuthorshipForRead) => {
168172
expect(canRead(isPublished, userId, authorId)).toBe(false);
@@ -220,8 +224,14 @@ describe('Logged-in user id', () => {
220224
const testCases = [
221225
{ userId: userId1, authorId: adminId, role: Roles.USER, isPublished: true },
222226
{ userId: userId1, authorId: adminId, role: Roles.USER, isPublished: false },
227+
{ userId: userId2, authorId: adminId, role: Roles.USER, isPublished: true },
228+
{ userId: userId2, authorId: adminId, role: Roles.USER, isPublished: false },
229+
{ userId: adminId, authorId: userId1, role: Roles.ADMIN, isPublished: false },
230+
{ userId: adminId, authorId: userId2, role: Roles.ADMIN, isPublished: false },
223231
{ userId: userId1, authorId: userId2, role: Roles.USER, isPublished: true },
224232
{ userId: userId1, authorId: userId2, role: Roles.USER, isPublished: false },
233+
{ userId: userId2, authorId: userId1, role: Roles.USER, isPublished: true },
234+
{ userId: userId2, authorId: userId1, role: Roles.USER, isPublished: false },
225235
];
226236
runTests(
227237
'canEdit',

0 commit comments

Comments
 (0)