feat: Update migration to clear all old non-account data

This is necessary to support the new internal format
This commit is contained in:
Joachim Van Herwegen
2023-10-10 15:00:07 +02:00
parent f954fc9450
commit 9daeaf89ac
5 changed files with 94 additions and 83 deletions

View File

@@ -40,8 +40,8 @@ describe('A SingleContainerJsonStorage', (): void => {
entries.push(entry);
}
expect(entries).toEqual([
[ '/foo', { id: 'http://example.com/.internal/accounts/foo' }],
[ '/baz', { id: 'http://example.com/.internal/accounts/baz' }],
[ 'foo', { id: 'http://example.com/.internal/accounts/foo' }],
[ 'baz', { id: 'http://example.com/.internal/accounts/baz' }],
]);
expect(store.getRepresentation).toHaveBeenCalledTimes(4);
expect(store.getRepresentation).toHaveBeenNthCalledWith(1,

View File

@@ -98,7 +98,7 @@ describe('A V6MigrationInitializer', (): void => {
versionStorage,
accountStorage,
clientCredentialsStorage,
forgotPasswordStorage,
cleanupStorages: [ accountStorage, clientCredentialsStorage, forgotPasswordStorage ],
newStorage,
skipConfirmation: true,
});
@@ -190,7 +190,7 @@ describe('A V6MigrationInitializer', (): void => {
versionStorage,
accountStorage,
clientCredentialsStorage,
forgotPasswordStorage,
cleanupStorages: [ accountStorage, clientCredentialsStorage, forgotPasswordStorage ],
newStorage,
skipConfirmation: false,
});
@@ -210,14 +210,5 @@ describe('A V6MigrationInitializer', (): void => {
await expect(initializer.handle()).rejects.toThrow('Stopping server as migration was cancelled.');
expect(newStorage.create).toHaveBeenCalledTimes(0);
});
it('does not show the prompt if there are no accounts.', async(): Promise<void> => {
settings = {};
accounts = {};
await expect(initializer.handle()).resolves.toBeUndefined();
expect(questionMock).toHaveBeenCalledTimes(0);
expect(accountStorage.get).toHaveBeenCalledTimes(0);
expect(newStorage.create).toHaveBeenCalledTimes(0);
});
});
});