mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 01:15:58 +00:00
test(plugin-users): add test cases
This commit is contained in:
parent
cde25ed871
commit
d79fc7be01
@ -86,5 +86,77 @@ describe('createdBy/updatedBy', () => {
|
||||
expect(data.createdBy.id).toBe(user1.get('id'));
|
||||
expect(data.updatedBy.id).toBe(user2.get('id'));
|
||||
});
|
||||
|
||||
it('input with createdById', async () => {
|
||||
const Post = db.collection({
|
||||
name: 'posts',
|
||||
createdBy: true,
|
||||
updatedBy: true,
|
||||
});
|
||||
await db.sync();
|
||||
|
||||
const u1 = await db.getCollection('users').model.create();
|
||||
const p1 = await Post.repository.create({
|
||||
values: {
|
||||
createdById: u1.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(p1.get('createdById')).toBe(u1.id);
|
||||
});
|
||||
|
||||
it.skip('input with createdBy', async () => {
|
||||
const Post = db.collection({
|
||||
name: 'posts',
|
||||
createdBy: true,
|
||||
updatedBy: true,
|
||||
});
|
||||
await db.sync();
|
||||
|
||||
const u1 = await db.getCollection('users').model.create();
|
||||
const p1 = await Post.repository.create({
|
||||
values: {
|
||||
createdBy: u1.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(p1.get('createdById')).toBe(u1.id);
|
||||
});
|
||||
|
||||
it.skip('input with updatedById', async () => {
|
||||
const Post = db.collection({
|
||||
name: 'posts',
|
||||
createdBy: true,
|
||||
updatedBy: true,
|
||||
});
|
||||
await db.sync();
|
||||
|
||||
const u1 = await db.getCollection('users').model.create();
|
||||
const p1 = await Post.repository.create({
|
||||
values: {
|
||||
updatedById: u1.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(p1.get('updatedById')).toBe(u1.id);
|
||||
});
|
||||
|
||||
it.skip('input with updatedBy', async () => {
|
||||
const Post = db.collection({
|
||||
name: 'posts',
|
||||
createdBy: true,
|
||||
updatedBy: true,
|
||||
});
|
||||
await db.sync();
|
||||
|
||||
const u1 = await db.getCollection('users').model.create();
|
||||
const p1 = await Post.repository.create({
|
||||
values: {
|
||||
updatedBy: u1.id,
|
||||
},
|
||||
});
|
||||
|
||||
expect(p1.get('updatedById')).toBe(u1.id);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user