Skip to content

Commit f68af80

Browse files
committed
chore: test snapshot
1 parent 63db93d commit f68af80

File tree

1 file changed

+61
-1
lines changed

1 file changed

+61
-1
lines changed

tests/cli.test.ts

Lines changed: 61 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,67 @@ describe('getGeneratedSchema', () => {
132132

133133
expect(generatedSchema).toContain('"customTypeJson": {');
134134

135-
expect(generatedSchema).toMatchInlineSnapshot();
135+
expect(generatedSchema).toMatchInlineSnapshot(`
136+
"// This file was automatically generated by drizzle-zero.
137+
// You should NOT make any changes in this file as it will be overwritten.
138+
139+
import type { Row } from "@rocicorp/zero";
140+
import { createBuilder } from "@rocicorp/zero";
141+
import type { ZeroCustomType } from "drizzle-zero";
142+
import type { schema as zeroSchema } from "./tests/schemas/one-to-one.zero";
143+
144+
const usersTable = {
145+
"name": "users",
146+
"primaryKey": ["id"],
147+
"columns": {
148+
"customTypeJson": {
149+
"type": "string",
150+
"optional": false,
151+
"customType": null as unknown as ZeroCustomType<typeof zeroSchema, "users", "customTypeJson">
152+
}
153+
}
154+
} as const;
155+
/**
156+
* The Zero schema object.
157+
* This type is auto-generated from your Drizzle schema definition.
158+
*/
159+
export const schema = {
160+
"tables": {
161+
"users": usersTable
162+
},
163+
"relationships": {}
164+
} as const;
165+
166+
/**
167+
* Represents the Zero schema type.
168+
* This type is auto-generated from your Drizzle schema definition.
169+
*/
170+
export type Schema = typeof schema;
171+
/**
172+
* Represents a row from the "users" table.
173+
* This type is auto-generated from your Drizzle schema definition.
174+
*
175+
* @deprecated Use Row["users"] instead from "@rocicorp/zero".
176+
*/
177+
export type User = Row["users"];
178+
179+
/**
180+
* Represents the ZQL query builder.
181+
* This type is auto-generated from your Drizzle schema definition.
182+
*/
183+
export const zql = createBuilder(schema);
184+
/**
185+
* Represents the Zero schema query builder.
186+
* This type is auto-generated from your Drizzle schema definition.
187+
*
188+
* @deprecated Use \`zql\` instead.
189+
*/
190+
export const builder = zql;
191+
192+
/** Defines the default types for Zero */
193+
declare module '@rocicorp/zero' { interface DefaultTypes { schema: Schema; } }
194+
"
195+
`);
136196
});
137197

138198
it('should throw error when export is not found in config file', () => {

0 commit comments

Comments
 (0)