1
0

chore: rename js files to ts

This commit is contained in:
Dominik Pschenitschni
2022-04-11 22:37:56 +02:00
committed by Gitea
parent 7fe9f17e43
commit 321850ec20
36 changed files with 0 additions and 0 deletions

24
cypress/support/seed.ts Normal file
View File

@ -0,0 +1,24 @@
/**
* Seeds a db table with data. If a data object is provided as the second argument, it will load the fixtures
* file for the table and merge the data from it with the passed data. This allows you to override specific
* fields of the fixtures without having to redeclare the whole fixture.
*
* Passing null as the second argument empties the table.
*
* @param table
* @param data
*/
export function seed(table, data = {}, truncate = true) {
if (data === null) {
data = []
}
cy.request({
method: 'PATCH',
url: `${Cypress.env('API_URL')}/test/${table}?truncate=${truncate ? 'true' : 'false'}`,
headers: {
'Authorization': Cypress.env('TEST_SECRET'),
},
body: data,
})
}