Add enabled local routing rules and gateway version reporting
This commit is contained in:
@@ -33,10 +33,10 @@ test('a failure before rename preserves the last successful file', (t) => {
|
||||
);
|
||||
});
|
||||
|
||||
test('schema v1 state migrates to the current schema and keeps a backup', (t) => {
|
||||
test('schema v2 state migrates built-in .ru into a normal enabled rule', (t) => {
|
||||
const filePath = fixture(t);
|
||||
const legacy = {
|
||||
schemaVersion: 1,
|
||||
schemaVersion: 2,
|
||||
revision: 7,
|
||||
selectedTag: 'nl',
|
||||
servers: [{ tag: 'nl' }],
|
||||
@@ -49,8 +49,11 @@ test('schema v1 state migrates to the current schema and keeps a backup', (t) =>
|
||||
const migrated = store.read();
|
||||
|
||||
assert.equal(migrated.schemaVersion, STATE_SCHEMA_VERSION);
|
||||
assert.deepEqual(migrated.routeRules, [
|
||||
{ type: 'domain_suffix', value: 'ru', enabled: true },
|
||||
]);
|
||||
assert.equal(migrated.appliedTag, 'nl');
|
||||
assert.equal(store.migration.fromVersion, 1);
|
||||
assert.equal(store.migration.fromVersion, 2);
|
||||
assert.deepEqual(JSON.parse(fs.readFileSync(store.migration.backupPath, 'utf8')), legacy);
|
||||
assert.equal(JSON.parse(fs.readFileSync(filePath, 'utf8')).schemaVersion, STATE_SCHEMA_VERSION);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user