Skip to content

Commit 7f4b4a2

Browse files
committed
Fix test
1 parent 4edd35d commit 7f4b4a2

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

apps/sim/lib/workflows/db-helpers.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,11 @@ describe('Database Helpers', () => {
434434
it('should successfully save workflow data to normalized tables', async () => {
435435
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
436436
const tx = {
437+
select: vi.fn().mockReturnValue({
438+
from: vi.fn().mockReturnValue({
439+
where: vi.fn().mockResolvedValue([]),
440+
}),
441+
}),
437442
delete: vi.fn().mockReturnValue({
438443
where: vi.fn().mockResolvedValue([]),
439444
}),
@@ -470,6 +475,11 @@ describe('Database Helpers', () => {
470475

471476
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
472477
const tx = {
478+
select: vi.fn().mockReturnValue({
479+
from: vi.fn().mockReturnValue({
480+
where: vi.fn().mockResolvedValue([]),
481+
}),
482+
}),
473483
delete: vi.fn().mockReturnValue({
474484
where: vi.fn().mockResolvedValue([]),
475485
}),
@@ -526,6 +536,11 @@ describe('Database Helpers', () => {
526536

527537
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
528538
const tx = {
539+
select: vi.fn().mockReturnValue({
540+
from: vi.fn().mockReturnValue({
541+
where: vi.fn().mockResolvedValue([]),
542+
}),
543+
}),
529544
delete: vi.fn().mockReturnValue({
530545
where: vi.fn().mockResolvedValue([]),
531546
}),
@@ -644,6 +659,11 @@ describe('Database Helpers', () => {
644659
it('should successfully migrate workflow from JSON to normalized tables', async () => {
645660
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
646661
const tx = {
662+
select: vi.fn().mockReturnValue({
663+
from: vi.fn().mockReturnValue({
664+
where: vi.fn().mockResolvedValue([]),
665+
}),
666+
}),
647667
delete: vi.fn().mockReturnValue({
648668
where: vi.fn().mockResolvedValue([]),
649669
}),
@@ -687,6 +707,11 @@ describe('Database Helpers', () => {
687707

688708
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
689709
const tx = {
710+
select: vi.fn().mockReturnValue({
711+
from: vi.fn().mockReturnValue({
712+
where: vi.fn().mockResolvedValue([]),
713+
}),
714+
}),
690715
delete: vi.fn().mockReturnValue({
691716
where: vi.fn().mockResolvedValue([]),
692717
}),
@@ -751,6 +776,11 @@ describe('Database Helpers', () => {
751776

752777
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
753778
const tx = {
779+
select: vi.fn().mockReturnValue({
780+
from: vi.fn().mockReturnValue({
781+
where: vi.fn().mockResolvedValue([]),
782+
}),
783+
}),
754784
delete: vi.fn().mockReturnValue({
755785
where: vi.fn().mockResolvedValue([]),
756786
}),
@@ -980,6 +1010,11 @@ describe('Database Helpers', () => {
9801010
// Mock the transaction for save operation
9811011
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
9821012
const mockTx = {
1013+
select: vi.fn().mockReturnValue({
1014+
from: vi.fn().mockReturnValue({
1015+
where: vi.fn().mockResolvedValue([]),
1016+
}),
1017+
}),
9831018
delete: vi.fn().mockReturnValue({
9841019
where: vi.fn().mockResolvedValue(undefined),
9851020
}),
@@ -1111,6 +1146,11 @@ describe('Database Helpers', () => {
11111146
// Mock successful save
11121147
const mockTransaction = vi.fn().mockImplementation(async (callback) => {
11131148
const mockTx = {
1149+
select: vi.fn().mockReturnValue({
1150+
from: vi.fn().mockReturnValue({
1151+
where: vi.fn().mockResolvedValue([]),
1152+
}),
1153+
}),
11141154
delete: vi.fn().mockReturnValue({
11151155
where: vi.fn().mockResolvedValue(undefined),
11161156
}),

0 commit comments

Comments
 (0)