mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
feat: integrate user usage into apis (#5075)
This commit is contained in:
@@ -4,6 +4,7 @@ import ava, { type TestFn } from 'ava';
|
||||
import { stub } from 'sinon';
|
||||
|
||||
import { AppModule } from '../src/app';
|
||||
import { Quotas } from '../src/modules/quota';
|
||||
import { UsersService } from '../src/modules/users';
|
||||
import { PermissionService } from '../src/modules/workspaces/permission';
|
||||
import { WorkspaceResolver } from '../src/modules/workspaces/resolver';
|
||||
@@ -20,6 +21,9 @@ class FakePermission {
|
||||
user: new FakePrisma().fakeUser,
|
||||
};
|
||||
}
|
||||
async getOwnedWorkspaces() {
|
||||
return [''];
|
||||
}
|
||||
}
|
||||
|
||||
const fakeUserService = {
|
||||
@@ -42,6 +46,19 @@ test.beforeEach(async t => {
|
||||
return [];
|
||||
},
|
||||
},
|
||||
userFeatures: {
|
||||
async count() {
|
||||
return 1;
|
||||
},
|
||||
async findFirst() {
|
||||
return {
|
||||
createdAt: new Date(),
|
||||
expiredAt: new Date(),
|
||||
reason: '',
|
||||
feature: Quotas[0],
|
||||
};
|
||||
},
|
||||
},
|
||||
})
|
||||
.overrideProvider(PermissionService)
|
||||
.useClass(FakePermission)
|
||||
|
||||
Reference in New Issue
Block a user