Skip to content

Commit e0a0f53

Browse files
committed
Enables external attachments in DocumentUsage
1 parent 5294fc1 commit e0a0f53

File tree

1 file changed

+25
-4
lines changed

1 file changed

+25
-4
lines changed

test/nbrowser/DocumentUsage.ts

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ describe('DocumentUsage', function() {
1414
let api: UserAPI;
1515
let session: gu.Session;
1616

17-
before(async function () {
18-
session = await gu.session().user(ownerUser).login();
17+
gu.enableExternalAttachments();
18+
19+
async function makeSessionAndLogin() {
20+
// login() needs an options object passing to bypass an optimization that causes .login()
21+
// to think we're already logged in when we're not after using `server.restart()`.
22+
// Without this we end up with bad credentials.
23+
session = await gu.session().user(ownerUser).login({ retainExistingLogin: false });
1924
api = session.createHomeApi();
25+
}
26+
27+
before(async function () {
28+
await makeSessionAndLogin();
2029
});
2130

2231
it('shows usage stats on the raw data page', async function() {
@@ -105,11 +114,15 @@ describe('DocumentUsage', function() {
105114
});
106115
});
107116

108-
describe('attachment usage', function() {
117+
function testAttachments(docSuffix: string) {
109118
let docId: string;
110119

111120
before(async () => {
112-
docId = await session.tempNewDoc(cleanup, "AttachmentUsageTestDoc");
121+
docId = await session.tempNewDoc(cleanup, `AttachmentUsageTestDoc - ${docSuffix}`);
122+
});
123+
124+
it('updates attachments size usage when uploading attachments', async function () {
125+
docId = await session.tempNewDoc(cleanup, `AttachmentUsageTestDoc - ${docSuffix}`);
113126
});
114127

115128
it('updates attachments size usage when uploading attachments', async function () {
@@ -147,6 +160,14 @@ describe('DocumentUsage', function() {
147160
await assertDataSize('0.00');
148161
await assertAttachmentsSize('0.00');
149162
});
163+
}
164+
165+
describe('attachment usage without external attachments', function() {
166+
testAttachments("without external attachments");
167+
});
168+
169+
describe('attachment usage with external attachments', function() {
170+
testAttachments("with external attachments");
150171
});
151172

152173
describe('doc usage access', function() {

0 commit comments

Comments
 (0)