Skip to content

Commit

Permalink
fix(tests): resolve breaking changes in joi post upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
uladkasach committed Feb 12, 2023
1 parent c59ca4c commit 1f63f0d
Show file tree
Hide file tree
Showing 24 changed files with 38 additions and 304 deletions.
4 changes: 0 additions & 4 deletions jest.unit.env.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import { stage, Stage } from './src/utils/environment';

jest.mock('./src/utils/config/getConfig', () => ({
getConfig: jest.fn().mockImplementation(() => require('./config/test.json')), // mock that getConfig just returns plaintext test env config in unit tests
}));

/**
* sanity check that unit tests are only run in 'test' environment
* - if they are run in prod environment, we could load a bunch of junk data into our prod databases, which would be no bueno
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`breakSqlIntoNestedSqlArraysAtParentheses should accurately break up this example 1`] = `
Array [
[
"SELECT
s.id,
s.uuid,
s.name,
",
Array [
[
"(
SELECT GROUP_CONCAT",
Array [
[
"(ice_cream_to_ingredient.ingredient_id ORDER BY ice_cream_to_ingredient.ingredient_id)",
],
"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`flattenNestedArraySqlByReferencingAndTokenizingSubqueriesRecursive should accurately flatten and tokenize this example 1`] = `
Array [
[
SqlSubqueryReference {
"id": "__UUID__",
"sql": "(
Expand Down

This file was deleted.

91 changes: 0 additions & 91 deletions src/contract/commands/__snapshots__/apply.test.integration.ts.snap

This file was deleted.

140 changes: 0 additions & 140 deletions src/contract/commands/__snapshots__/plan.test.integration.ts.snap

This file was deleted.

15 changes: 0 additions & 15 deletions src/contract/commands/__snapshots__/sync.test.integration.ts.snap

This file was deleted.

4 changes: 3 additions & 1 deletion src/domain/objects/ChangeDefinition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const schema = Joi.object().keys({
sql: Joi.string().required(),
hash: Joi.string().required().length(64), // sha256 hash
reappliable: Joi.boolean().required(),
status: Joi.string().valid(Object.values(ChangeDefinitionStatus)).optional(),
status: Joi.string()
.valid(...Object.values(ChangeDefinitionStatus))
.optional(),
});

interface ChangeDefinitionConstructorProps {
Expand Down
2 changes: 1 addition & 1 deletion src/domain/objects/ControlConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ConnectionConfig } from './ConnectionConfig';
import { ResourceDefinition } from './ResourceDefinition';

const schema = Joi.object().keys({
language: Joi.string().valid(Object.values(DatabaseLanguage)),
language: Joi.string().valid(...Object.values(DatabaseLanguage)),
dialect: Joi.string().required(),
strict: Joi.boolean().required(),
connection: ConnectionConfig.schema,
Expand Down
6 changes: 4 additions & 2 deletions src/domain/objects/ControlContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import { ChangeDefinition } from './ChangeDefinition';
import { ResourceDefinition } from './ResourceDefinition';

const schema = Joi.object().keys({
language: Joi.string().valid(Object.values(DatabaseLanguage)),
language: Joi.string().valid(...Object.values(DatabaseLanguage)),
dialect: Joi.string().required(),
connection: Joi.object().keys({
query: Joi.func().required(),
end: Joi.func().required(),
language: Joi.string().valid(Object.values(DatabaseLanguage)).required(),
language: Joi.string()
.valid(...Object.values(DatabaseLanguage))
.required(),
schema: Joi.string().required(),
}),
definitions: Joi.array().items(
Expand Down
Loading

0 comments on commit 1f63f0d

Please sign in to comment.