Skip to content

Commit

Permalink
WIP - tests working
Browse files Browse the repository at this point in the history
  • Loading branch information
pistachiobaby committed Jan 15, 2024
1 parent c6cabd5 commit 42e4989
Show file tree
Hide file tree
Showing 4 changed files with 165 additions and 76 deletions.
7 changes: 6 additions & 1 deletion spec/__support__/filesync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ export const makeSyncScenario = async ({
await localDir.loadIgnoreFile();

if (!localFiles[".gadget/sync.json"]) {
const syncJson: SyncJson = { app: testApp.slug, environment: "development", filesVersion: "1", mtime: Date.now() + 1 };
const syncJson: SyncJson = {
app: testApp.slug,
filesVersion: "1",
currentEnvironment: "development",
environments: { development: { filesVersion: "1" } },
};
await fs.outputJSON(localDir.absolute(".gadget/sync.json"), syncJson, { spaces: 2 });
}
}
Expand Down
42 changes: 21 additions & 21 deletions spec/commands/sync.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"2\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"2\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"2\\"}}}",
"file.txt": "file v2",
},
}
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"3\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"3\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"3\\"}}}",
"file.txt": "file v3",
},
}
Expand Down Expand Up @@ -153,7 +153,7 @@ describe("sync", () => {
".gadget/": "",
".gadget/backup/": "",
".gadget/backup/file.txt": "file v3",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"4\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"4\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"4\\"}}}",
},
}
`);
Expand Down Expand Up @@ -197,7 +197,7 @@ describe("sync", () => {
".gadget/": "",
".gadget/backup/": "",
".gadget/backup/file.txt": "file v3",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"5\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"5\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"5\\"}}}",
"directory/": "",
},
}
Expand Down Expand Up @@ -245,7 +245,7 @@ describe("sync", () => {
".gadget/backup/": "",
".gadget/backup/directory/": "",
".gadget/backup/file.txt": "file v3",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"6\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"6\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"6\\"}}}",
},
}
`);
Expand Down Expand Up @@ -316,7 +316,7 @@ describe("sync", () => {
".gadget/backup/": "",
".gadget/backup/directory/": "",
".gadget/backup/file.txt": "file v3",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"7\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"7\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"7\\"}}}",
"file1.txt": "file1.txt",
"file10.txt": "file10.txt",
"file2.txt": "file2.txt",
Expand Down Expand Up @@ -440,7 +440,7 @@ describe("sync", () => {
".gadget/backup/": "",
".gadget/backup/directory/": "",
".gadget/backup/file.txt": "file v3",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"7\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"7\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"7\\"}}}",
"file1.txt": "file1.txt",
"file10.txt": "file10.txt",
"file2.txt": "file2.txt",
Expand Down Expand Up @@ -576,7 +576,7 @@ describe("sync", () => {
".gadget/backup/": "",
".gadget/backup/directory/": "",
".gadget/backup/file.txt": "file v3",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"7\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"7\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"7\\"}}}",
"file.js": "file v2",
"file1.txt": "file1.txt",
"file10.txt": "file10.txt",
Expand Down Expand Up @@ -639,7 +639,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"2\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"2\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"2\\"}}}",
".ignore": "**/tmp",
},
}
Expand Down Expand Up @@ -680,7 +680,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"3\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"3\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"3\\"}}}",
".ignore": "**/tmp",
},
}
Expand Down Expand Up @@ -712,7 +712,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"2\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"2\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"2\\"}}}",
"file.txt": "file v2",
},
}
Expand Down Expand Up @@ -742,7 +742,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"3\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"3\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"3\\"}}}",
"file.txt": "file v3",
},
}
Expand Down Expand Up @@ -776,7 +776,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"4\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"4\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"4\\"}}}",
"renamed-file.txt": "file v3",
},
}
Expand Down Expand Up @@ -812,7 +812,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"5\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"5\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"5\\"}}}",
},
}
`);
Expand Down Expand Up @@ -852,7 +852,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"6\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"6\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"6\\"}}}",
"directory/": "",
},
}
Expand Down Expand Up @@ -897,7 +897,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"7\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"7\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"7\\"}}}",
"renamed-directory/": "",
},
}
Expand Down Expand Up @@ -944,7 +944,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"8\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"8\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"8\\"}}}",
},
}
`);
Expand Down Expand Up @@ -1020,7 +1020,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"9\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"9\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"9\\"}}}",
"file1.txt": "file1.txt",
"file10.txt": "file10.txt",
"file2.txt": "file2.txt",
Expand Down Expand Up @@ -1065,7 +1065,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"2\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"2\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"2\\"}}}",
"file.txt": "v10",
},
}
Expand Down Expand Up @@ -1131,7 +1131,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"1\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"1\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"1\\"}}}",
".ignore": "**/tmp",
"tmp/": "",
"tmp/file1.txt": "file1.txt",
Expand Down Expand Up @@ -1176,7 +1176,7 @@ describe("sync", () => {
},
"localDir": {
".gadget/": "",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"environment\\":\\"development\\",\\"filesVersion\\":\\"2\\"}",
".gadget/sync.json": "{\\"app\\":\\"test\\",\\"filesVersion\\":\\"2\\",\\"currentEnvironment\\":\\"development\\",\\"environments\\":{\\"development\\":{\\"filesVersion\\":\\"2\\"}}}",
".ignore": "# watch it all",
},
}
Expand Down
Loading

0 comments on commit 42e4989

Please sign in to comment.