Skip to content

Commit

Permalink
ci: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
stdavis committed Nov 29, 2024
1 parent 6279e98 commit 2192a7f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
test-unit:
name: Unit tests
runs-on: ubuntu-latest
env:
VITE_DATABASE_CONFIG: '{"databaseName":"DB_NAME","user":"USER"}'

steps:
- name: ⬇️ Set up code
Expand Down Expand Up @@ -84,3 +86,4 @@ jobs:
env:
VITE_DISCOVER_QUAD_WORD: ${{ secrets.DISCOVER_QUAD_WORD }}
VITE_FIREBASE_CONFIG: ${{ secrets.FIREBASE_CONFIG }}
VITE_DATABASE_CONFIG: ${{ secrets.DATABASE_CONFIG }}
12 changes: 6 additions & 6 deletions src/components/queryHelpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ describe('getStationQuery', () => {
},
];
const expected = removeIrrelevantWhiteSpace(
`(${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM DB_NAME.USER.TableOne
`(${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM ${config.databaseSecrets.databaseName}.${config.databaseSecrets.user}.TableOne
WHERE 1 = 1 AND 1 = 2))
AND (${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM DB_NAME.USER.TableTwo
AND (${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM ${config.databaseSecrets.databaseName}.${config.databaseSecrets.user}.TableTwo
WHERE 1 = 3))
AND (${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM DB_NAME.USER.TableThree
AND (${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM ${config.databaseSecrets.databaseName}.${config.databaseSecrets.user}.TableThree
WHERE 1 = 4))`,
);

Expand All @@ -45,7 +45,7 @@ describe('getStationQuery', () => {
table: 'TableOne',
},
];
const expected = `(1 = 1) AND (${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM DB_NAME.USER.TableOne WHERE 1 = 2))`;
const expected = `(1 = 1) AND (${config.fieldNames.STATION_ID} IN (SELECT ${config.fieldNames.STATION_ID} FROM ${config.databaseSecrets.databaseName}.${config.databaseSecrets.user}.TableOne WHERE 1 = 2))`;

const results = getStationQuery(input);
expect(results).toBe(expected);
Expand Down Expand Up @@ -74,9 +74,9 @@ describe('getStationQuery', () => {
},
];
const expected = removeIrrelevantWhiteSpace(`(${config.fieldNames.STATION_ID} IN (
SELECT ${config.fieldNames.STATION_ID} FROM DB_NAME.USER.${config.tableNames.events}
SELECT ${config.fieldNames.STATION_ID} FROM ${config.databaseSecrets.databaseName}.${config.databaseSecrets.user}.${config.tableNames.events}
WHERE ${config.fieldNames.EVENT_ID} IN (
SELECT ${config.fieldNames.EVENT_ID} FROM DB_NAME.USER.${config.tableNames.fish}
SELECT ${config.fieldNames.EVENT_ID} FROM ${config.databaseSecrets.databaseName}.${config.databaseSecrets.user}.${config.tableNames.fish}
WHERE 1 = 1
) AND 2 = 2
))`);
Expand Down

0 comments on commit 2192a7f

Please sign in to comment.