Skip to content

Commit

Permalink
Use more makeUserApi
Browse files Browse the repository at this point in the history
  • Loading branch information
fflorent committed Nov 5, 2024
1 parent 45d14d1 commit 00ed764
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions test/server/lib/DocApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function makeConfig(username: string): AxiosRequestConfig {
};
}

// Much like home.makeUserApi, except it injects extraHeadersForConfig (for tests with reverse-proxy)
function makeUserApi(
org: string,
username: string,
Expand Down Expand Up @@ -3108,11 +3109,7 @@ function testDocApi(settings: {
// Make two documents with same urlId
const ws1 = (await userApi.getOrgWorkspaces('current'))[0].id;
const doc1 = await userApi.newDoc({name: 'testdoc1', urlId: 'urlid'}, ws1);
const nasaApi = new UserAPIImpl(`${homeUrl}/o/nasa`, {
headers: chimpy.headers as Record<string, string>,
fetch: fetch as any,
newFormData: () => new FormData() as any,
});
const nasaApi = makeUserApi('nasa', 'chimpy');
const ws2 = (await nasaApi.getOrgWorkspaces('current'))[0].id;
const doc2 = await nasaApi.newDoc({name: 'testdoc2', urlId: 'urlid'}, ws2);
try {
Expand All @@ -3139,11 +3136,7 @@ function testDocApi(settings: {
// Make two documents
const ws1 = (await userApi.getOrgWorkspaces('current'))[0].id;
const doc1 = await userApi.newDoc({name: 'testdoc1'}, ws1);
const nasaApi = new UserAPIImpl(`${homeUrl}/o/nasa`, {
headers: chimpy.headers as Record<string, string>,
fetch: fetch as any,
newFormData: () => new FormData() as any,
});
const nasaApi = makeUserApi('nasa', 'chimpy');
const ws2 = (await nasaApi.getOrgWorkspaces('current'))[0].id;
const doc2 = await nasaApi.newDoc({name: 'testdoc2'}, ws2);
try {
Expand Down

0 comments on commit 00ed764

Please sign in to comment.