Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: prefer toBe over toStrictEqual #1044

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/operations/columns/alterColumn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`ALTER TABLE "distributors"
ALTER "address" DROP DEFAULT,
ALTER "address" SET DATA TYPE varchar(30) COLLATE C USING address::text,
Expand Down
4 changes: 2 additions & 2 deletions test/operations/columns/renameColumn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('operations', () => {
const statement = renameColumnFn('distributors', 'address', 'city');

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER TABLE "distributors" RENAME "address" TO "city";'
);
});
Expand All @@ -28,7 +28,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER TABLE "myschema"."distributors" RENAME "address" TO "city";'
);
});
Expand Down
6 changes: 3 additions & 3 deletions test/operations/constraints/addConstraint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('operations', () => {
const statement = addConstraintFn('distributors', 'zipchk', {});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(`ALTER TABLE "distributors"
expect(statement).toBe(`ALTER TABLE "distributors"
ADD ;`);
});

Expand All @@ -28,7 +28,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(`ALTER TABLE "distributors"
expect(statement).toBe(`ALTER TABLE "distributors"
ADD CONSTRAINT "zipchk" CHECK (char_length(zipcode) = 5) DEFERRABLE INITIALLY IMMEDIATE,
ADD CONSTRAINT "zipchk" CHECK (zipcode <> 0) DEFERRABLE INITIALLY IMMEDIATE,
ADD CONSTRAINT "zipchk" EXCLUDE zipcode WITH = DEFERRABLE INITIALLY IMMEDIATE;`);
Expand All @@ -45,7 +45,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`ALTER TABLE "myschema"."distributors"
ADD CONSTRAINT "zipchk" CHECK (char_length(zipcode) = 5);`
);
Expand Down
4 changes: 2 additions & 2 deletions test/operations/constraints/dropConstraint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('operations', () => {
const statement = dropConstraintFn('distributors', 'zipchk');

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER TABLE "distributors" DROP CONSTRAINT "zipchk";'
);
});
Expand All @@ -27,7 +27,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER TABLE "distributors" DROP CONSTRAINT IF EXISTS "zipchk" CASCADE;'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/constraints/renameConstraint.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER TABLE "distributors" RENAME CONSTRAINT "zipchk" TO "zip_check";'
);
});
Expand All @@ -32,7 +32,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER TABLE "myschema"."distributors" RENAME CONSTRAINT "zipchk" TO "zip_check";'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/functions/createFunction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`CREATE FUNCTION "add"(integer, integer)
RETURNS integer
AS $pga$select $1 + $2;$pga$
Expand All @@ -48,7 +48,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`CREATE OR REPLACE FUNCTION "add"(integer, integer)
RETURNS integer
AS $pga$select $1 + $2;$pga$
Expand Down
4 changes: 2 additions & 2 deletions test/operations/functions/dropFunction.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('operations', () => {
const statement = dropFunctionFn('sqrt', ['integer']);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual('DROP FUNCTION "sqrt"(integer);');
expect(statement).toBe('DROP FUNCTION "sqrt"(integer);');
});

it('should return sql statement with dropOptions', () => {
Expand All @@ -25,7 +25,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'DROP FUNCTION IF EXISTS "sqrt"(integer) CASCADE;'
);
});
Expand Down
6 changes: 3 additions & 3 deletions test/operations/indexes/createIndex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE INDEX "title_idx" ON "films" ("title");'
);
});
Expand All @@ -31,7 +31,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "films_title_unique_index" ON "films" ("title") INCLUDE ("director", "rating");'
);
});
Expand All @@ -42,7 +42,7 @@ describe('operations', () => {
]);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE INDEX "films_title_index" ON "myschema"."films" ("title" ASC);'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/indexes/dropIndex.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('operations', () => {
const statement = dropIndexFn('title_idx', []);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual('DROP INDEX "title_idx__index";');
expect(statement).toBe('DROP INDEX "title_idx__index";');
});

it('should return sql statement with dropOptions', () => {
Expand All @@ -26,7 +26,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'DROP INDEX CONCURRENTLY IF EXISTS "title_idx__index" CASCADE;'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/operators/addToOperatorFamily.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('operations', () => {
]);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`ALTER OPERATOR FAMILY "integer_ops" USING btree ADD
OPERATOR 1 "<"(int4, int2),
OPERATOR 2 "<="(int4, int2),
Expand Down Expand Up @@ -108,7 +108,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`ALTER OPERATOR FAMILY "myschema"."integer_ops" USING btree ADD
OPERATOR 1 "<"(int4, int2),
OPERATOR 2 "<="(int4, int2),
Expand Down
6 changes: 3 additions & 3 deletions test/operations/operators/createOperator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE OPERATOR === (PROCEDURE = "area_equal_function", LEFTARG = "box", RIGHTARG = "box");'
);
});
Expand All @@ -38,7 +38,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE OPERATOR === (PROCEDURE = "area_equal_function", LEFTARG = "box", RIGHTARG = "box", COMMUTATOR = ===, NEGATOR = !==, RESTRICT = "area_restriction_function", JOIN = "area_join_function", HASHES, MERGES);'
);
});
Expand All @@ -54,7 +54,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE OPERATOR myschema.=== (PROCEDURE = "area_equal_function", LEFTARG = "box", RIGHTARG = "box");'
);
});
Expand Down
2 changes: 1 addition & 1 deletion test/operations/operators/createOperatorClass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`CREATE OPERATOR CLASS "gist__int_ops" DEFAULT FOR TYPE "_int4" USING "gist" AS
FUNCTION 3 "&&"();`
);
Expand Down
6 changes: 3 additions & 3 deletions test/operations/operators/createOperatorFamily.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('operations', () => {
const statement = createOperatorFamilyFn('integer_ops', 'btree');

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE OPERATOR FAMILY "integer_ops" USING btree;'
);
});
Expand All @@ -28,7 +28,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE OPERATOR FAMILY "integer_ops" USING btree;'
);
});
Expand All @@ -40,7 +40,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'CREATE OPERATOR FAMILY "myschema"."integer_ops" USING btree;'
);
});
Expand Down
6 changes: 2 additions & 4 deletions test/operations/operators/dropOperator.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
'DROP OPERATOR ^("integer", "integer");'
);
expect(statement).toBe('DROP OPERATOR ^("integer", "integer");');
});

it('should return sql statement with dropOptions', () => {
Expand All @@ -31,7 +29,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'DROP OPERATOR IF EXISTS ~("none", "bit") CASCADE;'
);
});
Expand Down
6 changes: 2 additions & 4 deletions test/operations/operators/dropOperatorClass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ describe('operations', () => {
const statement = dropOperatorClassFn('widget_ops', 'btree');

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
'DROP OPERATOR CLASS "widget_ops" USING btree;'
);
expect(statement).toBe('DROP OPERATOR CLASS "widget_ops" USING btree;');
});

it('should return sql statement with dropOptions', () => {
Expand All @@ -27,7 +25,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'DROP OPERATOR CLASS IF EXISTS "widget_ops" USING btree CASCADE;'
);
});
Expand Down
6 changes: 2 additions & 4 deletions test/operations/operators/dropOperatorFamily.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ describe('operations', () => {
const statement = dropOperatorFamilyFn('float_ops', 'btree');

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
'DROP OPERATOR FAMILY "float_ops" USING btree;'
);
expect(statement).toBe('DROP OPERATOR FAMILY "float_ops" USING btree;');
});

it('should return sql statement with dropOptions', () => {
Expand All @@ -27,7 +25,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'DROP OPERATOR FAMILY IF EXISTS "float_ops" USING btree CASCADE;'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/operators/removeFromOperatorFamily.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('operations', () => {
]);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`ALTER OPERATOR FAMILY "integer_ops" USING btree DROP
OPERATOR 1 ""(int4, int2),
OPERATOR 2 ""(int4, int2),
Expand Down Expand Up @@ -71,7 +71,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
`ALTER OPERATOR FAMILY "myschema"."integer_ops" USING btree DROP
OPERATOR 1 ""(int4, int2),
OPERATOR 2 ""(int4, int2),
Expand Down
4 changes: 2 additions & 2 deletions test/operations/operators/renameOperatorClass.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER OPERATOR CLASS "gist__int_ops" USING gist RENAME TO "gist__int_ops_new";'
);
});
Expand All @@ -32,7 +32,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER OPERATOR CLASS "myschema"."gist__int_ops" USING gist RENAME TO "myschema"."gist__int_ops_new";'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/operators/renameOperatorFamily.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER OPERATOR FAMILY "integer_ops" USING btree RENAME TO "integer_ops_new";'
);
});
Expand All @@ -32,7 +32,7 @@ describe('operations', () => {
);

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER OPERATOR FAMILY "myschema"."integer_ops" USING btree RENAME TO "myschema"."integer_ops_new";'
);
});
Expand Down
4 changes: 2 additions & 2 deletions test/operations/policies/alterPolicy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe('operations', () => {
const statement = alterPolicyFn('my_table', 'p1', {});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual('ALTER POLICY "p1" ON "my_table" ;');
expect(statement).toBe('ALTER POLICY "p1" ON "my_table" ;');
});

it('should return sql statement with policyOptions', () => {
Expand All @@ -27,7 +27,7 @@ describe('operations', () => {
});

expect(statement).toBeTypeOf('string');
expect(statement).toStrictEqual(
expect(statement).toBe(
'ALTER POLICY "p1" ON "my_table" TO CURRENT_USER USING (true) WITH CHECK (true);'
);
});
Expand Down