mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Extracted importer test suite utils
refs https://github.com/TryGhost/Team/issues/555 - As part of testing upcoming 4.0 release was looking into a robust way to test imports. The importer test suite is humongous, so started with small extractions. - The goal is to have readable and easy to create version-specific "exports" that would allow for more convenient testing
This commit is contained in:
parent
7deeb41a36
commit
4f83716cfe
2 changed files with 97 additions and 90 deletions
|
@ -21,96 +21,7 @@ const importOptions = {
|
|||
|
||||
const knex = db.knex;
|
||||
|
||||
const exportedLatestBody = () => {
|
||||
return _.clone({
|
||||
db: [{
|
||||
meta: {
|
||||
exported_on: 1504269105806,
|
||||
version: '2.0.0'
|
||||
},
|
||||
data: {
|
||||
app_fields: [],
|
||||
app_settings: [],
|
||||
apps: [],
|
||||
brute: [],
|
||||
invites: [],
|
||||
migrations: [],
|
||||
permissions: [],
|
||||
permissions_roles: [],
|
||||
permissions_users: [],
|
||||
posts: [],
|
||||
posts_tags: [],
|
||||
posts_authors: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
subscribers: [],
|
||||
tags: [],
|
||||
users: []
|
||||
}
|
||||
}]
|
||||
});
|
||||
};
|
||||
|
||||
const exportedPreviousBody = () => {
|
||||
return _.clone({
|
||||
db: [{
|
||||
meta: {
|
||||
exported_on: 1504269105806,
|
||||
version: '1.20.0'
|
||||
},
|
||||
data: {
|
||||
app_fields: [],
|
||||
app_settings: [],
|
||||
apps: [],
|
||||
brute: [],
|
||||
invites: [],
|
||||
migrations: [],
|
||||
permissions: [],
|
||||
permissions_roles: [],
|
||||
permissions_users: [],
|
||||
posts: [],
|
||||
posts_tags: [],
|
||||
posts_authors: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
subscribers: [],
|
||||
tags: [],
|
||||
users: []
|
||||
}
|
||||
}]
|
||||
});
|
||||
};
|
||||
|
||||
const exportedLegacyBody = () => {
|
||||
return _.clone({
|
||||
db: [{
|
||||
meta: {
|
||||
exported_on: 1504269105806,
|
||||
version: '300'
|
||||
},
|
||||
data: {
|
||||
app_fields: [],
|
||||
app_settings: [],
|
||||
apps: [],
|
||||
brute: [],
|
||||
invites: [],
|
||||
permissions: [],
|
||||
permissions_roles: [],
|
||||
permissions_users: [],
|
||||
posts: [],
|
||||
posts_tags: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
subscribers: [],
|
||||
tags: [],
|
||||
users: []
|
||||
}
|
||||
}]
|
||||
});
|
||||
};
|
||||
const {exportedPreviousBody, exportedLegacyBody, exportedLatestBody} = require('./utils/fixtures');
|
||||
|
||||
// Tests in here do an import for each test
|
||||
describe('Integration: Importer', function () {
|
||||
|
|
96
test/regression/importer/utils/fixtures.js
Normal file
96
test/regression/importer/utils/fixtures.js
Normal file
|
@ -0,0 +1,96 @@
|
|||
const _ = require('lodash');
|
||||
|
||||
const exportedLatestBody = () => {
|
||||
return _.clone({
|
||||
db: [{
|
||||
meta: {
|
||||
exported_on: 1504269105806,
|
||||
version: '2.0.0'
|
||||
},
|
||||
data: {
|
||||
app_fields: [],
|
||||
app_settings: [],
|
||||
apps: [],
|
||||
brute: [],
|
||||
invites: [],
|
||||
migrations: [],
|
||||
permissions: [],
|
||||
permissions_roles: [],
|
||||
permissions_users: [],
|
||||
posts: [],
|
||||
posts_tags: [],
|
||||
posts_authors: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
subscribers: [],
|
||||
tags: [],
|
||||
users: []
|
||||
}
|
||||
}]
|
||||
});
|
||||
};
|
||||
|
||||
const exportedPreviousBody = () => {
|
||||
return _.clone({
|
||||
db: [{
|
||||
meta: {
|
||||
exported_on: 1504269105806,
|
||||
version: '1.20.0'
|
||||
},
|
||||
data: {
|
||||
app_fields: [],
|
||||
app_settings: [],
|
||||
apps: [],
|
||||
brute: [],
|
||||
invites: [],
|
||||
migrations: [],
|
||||
permissions: [],
|
||||
permissions_roles: [],
|
||||
permissions_users: [],
|
||||
posts: [],
|
||||
posts_tags: [],
|
||||
posts_authors: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
subscribers: [],
|
||||
tags: [],
|
||||
users: []
|
||||
}
|
||||
}]
|
||||
});
|
||||
};
|
||||
|
||||
const exportedLegacyBody = () => {
|
||||
return _.clone({
|
||||
db: [{
|
||||
meta: {
|
||||
exported_on: 1504269105806,
|
||||
version: '300'
|
||||
},
|
||||
data: {
|
||||
app_fields: [],
|
||||
app_settings: [],
|
||||
apps: [],
|
||||
brute: [],
|
||||
invites: [],
|
||||
permissions: [],
|
||||
permissions_roles: [],
|
||||
permissions_users: [],
|
||||
posts: [],
|
||||
posts_tags: [],
|
||||
roles: [],
|
||||
roles_users: [],
|
||||
settings: [],
|
||||
subscribers: [],
|
||||
tags: [],
|
||||
users: []
|
||||
}
|
||||
}]
|
||||
});
|
||||
};
|
||||
|
||||
module.exports.exportedLatestBody = exportedLatestBody;
|
||||
module.exports.exportedPreviousBody = exportedPreviousBody;
|
||||
module.exports.exportedLegacyBody = exportedLegacyBody;
|
Loading…
Reference in a new issue