Fix test and upgrade github workflows

This commit is contained in:
Alexandre Bodin 2021-09-21 15:14:26 +02:00
parent f18cf15894
commit 4eea2b1569
4 changed files with 21 additions and 21 deletions

View File

@ -73,7 +73,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
services: services:
postgres: postgres:
# Docker Hub image # Docker Hub image
@ -109,7 +109,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
services: services:
mysql: mysql:
image: mysql image: mysql
@ -140,11 +140,11 @@ jobs:
e2e_ce_mysql_5: e2e_ce_mysql_5:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: [lint, unit_back, unit_front] needs: [lint, unit_back, unit_front]
name: '[CE] E2E (mysql, node: ${{ matrix.node }})' name: '[CE] E2E (mysql:5 , node: ${{ matrix.node }})'
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
services: services:
mysql: mysql:
image: mysql:5 image: mysql:5
@ -179,7 +179,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta - uses: actions/setup-node@v2-beta
@ -201,7 +201,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
services: services:
postgres: postgres:
# Docker Hub image # Docker Hub image
@ -241,7 +241,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
services: services:
mysql: mysql:
image: mysql image: mysql
@ -280,7 +280,7 @@ jobs:
strategy: strategy:
matrix: matrix:
node: [12, 14, 16] node: [12, 14, 16]
max-parallel: 2 max-parallel: 3
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- uses: actions/setup-node@v2-beta - uses: actions/setup-node@v2-beta

View File

@ -4,6 +4,7 @@ const sqlite = {
filename: '.tmp/data.db', filename: '.tmp/data.db',
}, },
useNullAsDefault: true, useNullAsDefault: true,
debug: true,
}; };
const postgres = { const postgres = {

View File

@ -50,7 +50,6 @@ const toStrapiType = column => {
case 'time': { case 'time': {
return { type: 'time', args: [{ precision: 3 }] }; return { type: 'time', args: [{ precision: 3 }] };
} }
// TODO: enum
default: { default: {
return { type: 'specificType', args: [column.data_type] }; return { type: 'specificType', args: [column.data_type] };
} }
@ -107,26 +106,16 @@ class SqliteSchemaInspector {
} }
async getIndexes(tableName) { async getIndexes(tableName) {
// const cols = await this.db.connection.raw(SQL_QUERIES.TABLE_INFO, [tableName]);
const indexes = await this.db.connection.raw(SQL_QUERIES.INDEX_LIST, [tableName]); const indexes = await this.db.connection.raw(SQL_QUERIES.INDEX_LIST, [tableName]);
const ret = []; const ret = [];
// for (const col of cols.filter(c => c.pk)) {
// ret.push({
// columns: [col.name],
// type: 'primary',
// });
// }
// merge pk together
for (const index of indexes.filter(index => !index.name.startsWith('sqlite_'))) { for (const index of indexes.filter(index => !index.name.startsWith('sqlite_'))) {
const res = await this.db.connection.raw(SQL_QUERIES.INDEX_INFO, [index.name]); const res = await this.db.connection.raw(SQL_QUERIES.INDEX_INFO, [index.name]);
ret.push({ ret.push({
columns: res.map(row => row.name), columns: res.map(row => row.name),
name: index.name, name: index.name,
// TODO: find other index types
type: index.unique ? 'unique' : null, type: index.unique ? 'unique' : null,
}); });
} }

View File

@ -228,7 +228,12 @@ describe('Non repeatable and required component', () => {
}); });
expect(updateRes.statusCode).toBe(200); expect(updateRes.statusCode).toBe(200);
expect(updateRes.body.data).toMatchObject(res.body.data); expect(updateRes.body.data).toMatchObject({
id: res.body.data.id,
attributes: {
field: res.body.data.attributes.field,
},
});
const getRes = await rq.get(`/${res.body.data.id}`, { const getRes = await rq.get(`/${res.body.data.id}`, {
qs: { qs: {
@ -237,7 +242,12 @@ describe('Non repeatable and required component', () => {
}); });
expect(getRes.statusCode).toBe(200); expect(getRes.statusCode).toBe(200);
expect(getRes.body.data).toMatchObject(res.body.data); expect(getRes.body.data).toMatchObject({
id: res.body.data.id,
attributes: {
field: res.body.data.attributes.field,
},
});
}); });
test('Throws if component is null', async () => { test('Throws if component is null', async () => {