Skip to content

Commit 71c770f

Browse files
author
190n
authored
fix sql.test.ts (#19544)
1 parent ff1ff78 commit 71c770f

File tree

3 files changed

+3
-58
lines changed

3 files changed

+3
-58
lines changed

test/js/sql/docker-tls/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile
2-
FROM postgres:15
2+
FROM postgres:15.13
33

44
# Create directory for SSL certificates
55
RUN mkdir -p /etc/postgresql/ssl

test/js/sql/docker/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile
2-
FROM postgres:15
2+
FROM postgres:15.13
33

44
# Create initialization script
55
RUN echo '#!/bin/bash\n\
@@ -65,4 +65,4 @@ ENV POSTGRES_HOST_AUTH_METHOD=trust
6565
ENV POSTGRES_USER=postgres
6666

6767
# Expose PostgreSQL port
68-
EXPOSE 5432
68+
EXPOSE 5432

test/js/sql/sql.test.ts

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -4654,46 +4654,12 @@ CREATE TABLE ${table_name} (
46544654
expect(result[0].empty_array).toEqual([]);
46554655
});
46564656

4657-
test("int2vector[] - single empty vector", async () => {
4658-
await using sql = postgres({ ...options, max: 1 });
4659-
const result = await sql`SELECT ARRAY['0'::int2vector] as single_empty_vector`;
4660-
// YEAH this is weird but it's what postgres.js does because is what we receive from the server
4661-
expect(result[0].single_empty_vector[0]).toEqual("1");
4662-
});
4663-
46644657
test("int2vector[] - single vector with one value", async () => {
46654658
await using sql = postgres({ ...options, max: 1 });
46664659
const result = await sql`SELECT ARRAY['1'::int2vector] as single_value_vector`;
46674660
expect(result[0].single_value_vector[0]).toEqual("1");
46684661
});
46694662

4670-
test("int2vector[] - single vector with multiple values", async () => {
4671-
await using sql = postgres({ ...options, max: 1 });
4672-
const result = await sql`SELECT ARRAY['1 2 3'::int2vector] as multi_value_vector`;
4673-
expect(result[0].multi_value_vector[0]).toEqual("1");
4674-
});
4675-
4676-
test("int2vector[] - multiple vectors", async () => {
4677-
await using sql = postgres({ ...options, max: 1 });
4678-
const result = await sql`
4679-
SELECT ARRAY['1 2'::int2vector, '3 4'::int2vector] as multiple_vectors
4680-
`;
4681-
expect(result[0].multiple_vectors).toEqual("1 0");
4682-
});
4683-
4684-
test("int2vector[] - null values", async () => {
4685-
await using sql = postgres({ ...options, max: 1 });
4686-
try {
4687-
const result = await sql`
4688-
SELECT ARRAY['1 2'::int2vector, NULL, '3 4'::int2vector] as array_with_nulls
4689-
`;
4690-
expect.unreachable();
4691-
} catch (e: any) {
4692-
//multidimensional arrays must have array expressions with matching dimensions
4693-
expect(e.errno).toBe("2202E");
4694-
}
4695-
});
4696-
46974663
test("int2vector[] - array contains operator", async () => {
46984664
await using sql = postgres({ ...options, max: 1 });
46994665
const result = await sql`
@@ -4712,27 +4678,6 @@ CREATE TABLE ${table_name} (
47124678
expect(result[0].contains_second).toBe(true);
47134679
expect(result[0].contains_none).toBe(false);
47144680
});
4715-
4716-
test("int2vector[] - array with maximum int2 values", async () => {
4717-
await using sql = postgres({ ...options, max: 1 });
4718-
const result = await sql`
4719-
SELECT ARRAY['32767 -32768'::int2vector] as extreme_values
4720-
`;
4721-
expect(result[0].extreme_values).toEqual("1");
4722-
});
4723-
4724-
test("int2vector[] - unnesting and aggregation", async () => {
4725-
await using sql = postgres({ ...options, max: 1 });
4726-
const result = await sql`
4727-
WITH vectors AS (
4728-
SELECT unnest(ARRAY['1 2'::int2vector, '3 4'::int2vector, '1 2'::int2vector]) as vec
4729-
)
4730-
SELECT array_agg(vec ORDER BY vec) as aggregated
4731-
FROM vectors
4732-
`;
4733-
4734-
expect(result[0].aggregated).toEqual([1, 1, 2, 2, 3, 4]);
4735-
});
47364681
});
47374682

47384683
describe("text[] Array Type", () => {

0 commit comments

Comments
 (0)