mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-10 03:03:37 +02:00
Update importers for folder environment and fix tests
This commit is contained in:
@@ -31,16 +31,20 @@ describe('importer-yaak', () => {
|
||||
JSON.stringify({
|
||||
yaakSchema: 2,
|
||||
resources: {
|
||||
environments: [{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Production',
|
||||
variables: [{ name: 'E1', value: 'E1!' }],
|
||||
}],
|
||||
workspaces: [{
|
||||
id: 'w_1',
|
||||
variables: [{ name: 'W1', value: 'W1!' }],
|
||||
}],
|
||||
environments: [
|
||||
{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Production',
|
||||
variables: [{ name: 'E1', value: 'E1!' }],
|
||||
},
|
||||
],
|
||||
workspaces: [
|
||||
{
|
||||
id: 'w_1',
|
||||
variables: [{ name: 'W1', value: 'W1!' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
@@ -48,21 +52,98 @@ describe('importer-yaak', () => {
|
||||
expect(imported).toEqual(
|
||||
expect.objectContaining({
|
||||
resources: {
|
||||
workspaces: [{
|
||||
id: 'w_1',
|
||||
}],
|
||||
environments: [{
|
||||
id: 'e_1',
|
||||
base: false,
|
||||
workspaceId: 'w_1',
|
||||
name: 'Production',
|
||||
variables: [{ name: 'E1', value: 'E1!' }],
|
||||
}, {
|
||||
id: 'GENERATE_ID::base_env_w_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Global Variables',
|
||||
variables: [{ name: 'W1', value: 'W1!' }],
|
||||
}],
|
||||
workspaces: [
|
||||
{
|
||||
id: 'w_1',
|
||||
},
|
||||
],
|
||||
environments: [
|
||||
{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Production',
|
||||
variables: [{ name: 'E1', value: 'E1!' }],
|
||||
parentModel: 'environment',
|
||||
parentId: null,
|
||||
},
|
||||
{
|
||||
id: 'GENERATE_ID::base_env_w_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Global Variables',
|
||||
variables: [{ name: 'W1', value: 'W1!' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
test('converts schema 4 to 5', () => {
|
||||
const imported = migrateImport(
|
||||
JSON.stringify({
|
||||
yaakSchema: 2,
|
||||
resources: {
|
||||
environments: [
|
||||
{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
base: false,
|
||||
name: 'Production',
|
||||
variables: [{ name: 'E1', value: 'E1!' }],
|
||||
},
|
||||
{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
base: true,
|
||||
name: 'Global Variables',
|
||||
variables: [{ name: 'G1', value: 'G1!' }],
|
||||
},
|
||||
],
|
||||
folders: [
|
||||
{
|
||||
id: 'f_1',
|
||||
},
|
||||
],
|
||||
workspaces: [
|
||||
{
|
||||
id: 'w_1',
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(imported).toEqual(
|
||||
expect.objectContaining({
|
||||
resources: {
|
||||
workspaces: [
|
||||
{
|
||||
id: 'w_1',
|
||||
},
|
||||
],
|
||||
folders: [
|
||||
{
|
||||
id: 'f_1',
|
||||
},
|
||||
],
|
||||
environments: [
|
||||
{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Production',
|
||||
variables: [{ name: 'E1', value: 'E1!' }],
|
||||
parentModel: 'environment',
|
||||
parentId: null,
|
||||
},
|
||||
{
|
||||
id: 'e_1',
|
||||
workspaceId: 'w_1',
|
||||
name: 'Global Variables',
|
||||
parentModel: 'workspace',
|
||||
parentId: null,
|
||||
variables: [{ name: 'G1', value: 'G1!' }],
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user