-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use correct user types in client tests
- Loading branch information
Showing
10 changed files
with
59 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,24 @@ | ||
import { getFakeRegisteredUser } from "@tests/test-data"; | ||
|
||
import { | ||
type AnonymousUser, | ||
type AnyHistory, | ||
type HistorySummary, | ||
type HistorySummaryExtended, | ||
isRegisteredUser, | ||
type User, | ||
userOwnsHistory, | ||
} from "."; | ||
|
||
const REGISTERED_USER_ID = "fake-user-id"; | ||
const ANOTHER_USER_ID = "another-fake-user-id"; | ||
const ANONYMOUS_USER_ID = null; | ||
|
||
const REGISTERED_USER: User = { | ||
id: REGISTERED_USER_ID, | ||
email: "[email protected]", | ||
tags_used: [], | ||
isAnonymous: false, | ||
total_disk_usage: 0, | ||
}; | ||
const REGISTERED_USER = getFakeRegisteredUser({ id: REGISTERED_USER_ID }); | ||
|
||
const ANONYMOUS_USER: AnonymousUser = { | ||
isAnonymous: true, | ||
total_disk_usage: 0, | ||
nice_total_disk_usage: "0.0 bytes", | ||
}; | ||
|
||
const SESSIONLESS_USER = null; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { type RegisteredUser } from "@/api"; | ||
|
||
export function getFakeRegisteredUser(data: Partial<RegisteredUser> = {}): RegisteredUser { | ||
return { | ||
id: "fake_user_id", | ||
email: "fake_user_email", | ||
tags_used: [], | ||
isAnonymous: false, | ||
username: "fake_username", | ||
total_disk_usage: 0, | ||
nice_total_disk_usage: "0.0 bytes", | ||
deleted: false, | ||
purged: false, | ||
is_admin: false, | ||
preferences: {}, | ||
quota: "default", | ||
...data, | ||
}; | ||
} |