-
-
Notifications
You must be signed in to change notification settings - Fork 294
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
c4744ce
commit 6f33774
Showing
10 changed files
with
95 additions
and
78 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
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,50 @@ | ||
/* eslint-disable sonarjs/no-duplicate-string */ | ||
import type { INestApplication } from '@nestjs/common'; | ||
import type { ITableFullVo } from '@teable/core'; | ||
import { FieldKeyType } from '@teable/core'; | ||
import { createRecords, createTable, deleteTable, initApp } from './utils/init-app'; | ||
|
||
describe('Credit limit (e2e)', () => { | ||
let app: INestApplication; | ||
const baseId = globalThis.testConfig.baseId; | ||
|
||
beforeAll(async () => { | ||
process.env.MAX_FREE_ROW_LIMIT = '10'; | ||
const appCtx = await initApp(); | ||
app = appCtx.app; | ||
}); | ||
|
||
afterAll(async () => { | ||
process.env.MAX_FREE_ROW_LIMIT = undefined; | ||
await app.close(); | ||
}); | ||
|
||
describe('max row limit', () => { | ||
let table: ITableFullVo; | ||
beforeEach(async () => { | ||
table = await createTable(baseId, { name: 'table1' }); | ||
}); | ||
|
||
afterEach(async () => { | ||
await deleteTable(baseId, table.id); | ||
}); | ||
|
||
it('should create a record', async () => { | ||
// create 6 record succeed, 3(default) + 7 = 10 | ||
await createRecords(table.id, { | ||
fieldKeyType: FieldKeyType.Name, | ||
records: Array.from({ length: 7 }).map(() => ({ fields: {} })), | ||
}); | ||
|
||
// limit exceed | ||
await createRecords( | ||
table.id, | ||
{ | ||
fieldKeyType: FieldKeyType.Name, | ||
records: [{ fields: {} }], | ||
}, | ||
400 | ||
); | ||
}); | ||
}); | ||
}); |
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
2 changes: 2 additions & 0 deletions
2
packages/db-main-prisma/prisma/postgres/migrations/20240313062534_add_credit/migration.sql
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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "space" ADD COLUMN "credit" INTEGER; |
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
2 changes: 2 additions & 0 deletions
2
packages/db-main-prisma/prisma/sqlite/migrations/20240313061543_add_credit/migration.sql
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,2 @@ | ||
-- AlterTable | ||
ALTER TABLE "space" ADD COLUMN "credit" INTEGER; |
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