@@ -79,49 +79,6 @@ test("Concurrent writes", async (t) => {
7979 cleanup ( t . context ) ;
8080} ) ;
8181
82- test ( "Concurrent transaction isolation" , async ( t ) => {
83- const db = t . context . db ;
84-
85- await db . exec ( `
86- DROP TABLE IF EXISTS transaction_users;
87- CREATE TABLE transaction_users (
88- id TEXT PRIMARY KEY,
89- name TEXT,
90- email TEXT
91- )
92- ` ) ;
93-
94- const aliceId = generateUUID ( ) ;
95- const bobId = generateUUID ( ) ;
96-
97- await db . exec ( `
98- INSERT INTO transaction_users (id, name, email) VALUES
99- ('${ aliceId } ', 'Alice', 'alice@example.org'),
100- ('${ bobId } ', 'Bob', 'bob@example.com')
101- ` ) ;
102-
103- const updateUser = db . transaction ( async ( id , name , email ) => {
104- const stmt = await db . prepare ( "UPDATE transaction_users SET name = :name, email = :email WHERE id = :id" ) ;
105- await stmt . run ( { id, name, email } ) ;
106- } ) ;
107-
108- const promises = [ ] ;
109- for ( let i = 0 ; i < 10 ; i ++ ) {
110- promises . push ( updateUser ( aliceId , `Alice${ i } ` , `alice${ i } @example.org` ) ) ;
111- promises . push ( updateUser ( bobId , `Bob${ i } ` , `bob${ i } @example.com` ) ) ;
112- }
113-
114- await Promise . all ( promises ) ;
115-
116- const stmt = await db . prepare ( "SELECT * FROM transaction_users ORDER BY name" ) ;
117- const results = await stmt . all ( ) ;
118- t . is ( results . length , 2 ) ;
119- t . truthy ( results [ 0 ] . name . startsWith ( 'Alice' ) ) ;
120- t . truthy ( results [ 1 ] . name . startsWith ( 'Bob' ) ) ;
121-
122- cleanup ( t . context ) ;
123- } ) ;
124-
12582test ( "Concurrent reads and writes" , async ( t ) => {
12683 const db = t . context . db ;
12784
0 commit comments