|
1 | 1 | import { compareIds, putOp, reduceBucket, removeOp, test_utils } from '@powersync/service-core-tests'; |
2 | 2 | import * as timers from 'timers/promises'; |
3 | | -import { describe, expect, test, it } from 'vitest'; |
| 3 | +import { describe, expect, test } from 'vitest'; |
4 | 4 |
|
5 | 5 | import { storage } from '@powersync/service-core'; |
6 | 6 | import { describeWithStorage } from './util.js'; |
@@ -591,23 +591,35 @@ function defineTests(factory: storage.TestStorageFactory) { |
591 | 591 | expect(failures).toEqual([]); |
592 | 592 | }); |
593 | 593 |
|
594 | | - it.skip('custom types', async () => { |
| 594 | + test('custom types', async () => { |
595 | 595 | await using context = await WalStreamTestContext.open(factory); |
596 | 596 |
|
597 | 597 | await context.updateSyncRules(` |
598 | 598 | streams: |
599 | 599 | stream: |
600 | | - query: SELECT id, * FROM "test_data" |
| 600 | + query: SELECT * FROM "test_data" |
601 | 601 |
|
602 | 602 | config: |
603 | 603 | edition: 2 |
604 | 604 | `); |
605 | 605 |
|
606 | 606 | const { pool } = context; |
607 | | - await pool.query(`DROP TABLE IF EXISTS test_data`); |
608 | | - await pool.query(`CREATE TABLE test_data(id text primary key, description composite);`); |
609 | | - await pool.query(`INSERT INTO test_data(id, description) VALUES ('t1', ROW(TRUE, 2)::composite)`); |
| 607 | + await pool.query(`CREATE TABLE test_data(id text primary key);`); |
| 608 | + await pool.query(`INSERT INTO test_data(id) VALUES ('t1')`); |
610 | 609 |
|
611 | 610 | await context.replicateSnapshot(); |
| 611 | + context.startStreaming(); |
| 612 | + |
| 613 | + await pool.query( |
| 614 | + { statement: `CREATE TYPE composite AS (foo bool, bar int4);` }, |
| 615 | + { statement: `ALTER TABLE test_data ADD COLUMN other composite;` }, |
| 616 | + { statement: `UPDATE test_data SET other = ROW(TRUE, 2)::composite;` } |
| 617 | + ); |
| 618 | + |
| 619 | + const data = await context.getBucketData('1#stream|0[]'); |
| 620 | + expect(data).toMatchObject([ |
| 621 | + putOp('test_data', { id: 't1' }), |
| 622 | + putOp('test_data', { id: 't1', other: '{"foo":1,"bar":2}' }) |
| 623 | + ]); |
612 | 624 | }); |
613 | 625 | } |
0 commit comments