-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ceed02b
commit 243d7a4
Showing
5 changed files
with
110 additions
and
23 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 |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { PatreonMock, RouteBases, Routes } from 'patreon-api.ts' | ||
|
||
const mock = new PatreonMock({ | ||
cache: { | ||
initial: { | ||
campaign: new Map([ | ||
['my-campaign-id', { | ||
item: { | ||
patron_count: 7, | ||
is_monthly: true, | ||
// ... All other campaign attributes | ||
}, | ||
relationships: { | ||
creator: 'creator-id', | ||
// If the campaign has benefits, goals or tiers | ||
// Add these also the cache | ||
benefits: [], | ||
goals: [], | ||
tiers: [], | ||
} | ||
}], | ||
]), | ||
user: new Map([ | ||
['creator-id', { | ||
item: { | ||
about: null, | ||
is_creator: true, | ||
// ... All other user attributes | ||
}, | ||
relationships: { | ||
campaign: 'my-campaign-id', | ||
memberships: [], | ||
}, | ||
}] | ||
]) | ||
} | ||
} | ||
}) | ||
|
||
export function getCachedCampaign () { | ||
return mock.getMockHandlers().getCampaign.handler({ | ||
url: RouteBases.oauth2 + Routes.campaign('my-campaign-id'), | ||
headers: mock.data.createHeaders(), | ||
}) | ||
} |
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