Skip to content

Commit 2e40628

Browse files
committed
model save, model saveMany integration tests
1 parent 2e81c58 commit 2e40628

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Diff for: tests/integration_tests/model/Model.test.ts

+22
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,28 @@ describe('Model', () =>
6262
expect(user.firstName).toEqual('test1');
6363
});
6464

65+
test('save', async () =>
66+
{
67+
const firstName = 'test test';
68+
let user = await User.findById(1);
69+
user.firstName = firstName;
70+
await user.save();
71+
72+
user = await User.findById(1);
73+
expect(user.firstName).toEqual(firstName);
74+
});
75+
76+
test('saveMany', async () =>
77+
{
78+
await User.saveMany([
79+
{id: 3, firstName: 'test3'},
80+
{id: 4, firstName: 'test4'}
81+
]);
82+
83+
const users = await User.all();
84+
expect(users.length).toEqual(4);
85+
});
86+
6587
test('select', async () =>
6688
{
6789
const users = await User.select(['id']).orderBy('id', 'asc').get();

0 commit comments

Comments
 (0)