mirror of
https://github.com/wassname/talk.git
synced 2026-07-09 15:54:22 +08:00
expanded on migration support
This commit is contained in:
@@ -5,6 +5,9 @@ const chai = require('chai');
|
||||
chai.use(require('chai-datetime'));
|
||||
const { expect } = chai;
|
||||
|
||||
const performMigration = () =>
|
||||
migration.up({ queryBatchSize: 100, updateBatchSize: 100 });
|
||||
|
||||
describe('migration.1510174676_user_status', () => {
|
||||
describe('active user', () => {
|
||||
beforeEach(async () => {
|
||||
@@ -24,7 +27,7 @@ describe('migration.1510174676_user_status', () => {
|
||||
expect(user).to.have.property('canEditName', false);
|
||||
|
||||
// Perform the migration.
|
||||
await migration.up();
|
||||
await performMigration();
|
||||
|
||||
user = await UserModel.collection.findOne({ id: '123' });
|
||||
|
||||
@@ -54,7 +57,7 @@ describe('migration.1510174676_user_status', () => {
|
||||
expect(user).to.have.property('canEditName', true);
|
||||
|
||||
// Perform the migration.
|
||||
await migration.up();
|
||||
await performMigration();
|
||||
|
||||
user = await UserModel.collection.findOne({ id: '123' });
|
||||
|
||||
@@ -85,7 +88,7 @@ describe('migration.1510174676_user_status', () => {
|
||||
expect(user.canEditName).to.equal(true);
|
||||
|
||||
// Perform the migration.
|
||||
await migration.up();
|
||||
await performMigration();
|
||||
|
||||
user = await UserModel.collection.findOne({ id: '123' });
|
||||
|
||||
@@ -117,7 +120,7 @@ describe('migration.1510174676_user_status', () => {
|
||||
expect(user.canEditName).to.equal(false);
|
||||
|
||||
// Perform the migration.
|
||||
await migration.up();
|
||||
await performMigration();
|
||||
|
||||
user = await UserModel.collection.findOne({ id: '123' });
|
||||
|
||||
@@ -153,7 +156,7 @@ describe('migration.1510174676_user_status', () => {
|
||||
const until = user.suspension.until;
|
||||
|
||||
// Perform the migration.
|
||||
await migration.up();
|
||||
await performMigration();
|
||||
|
||||
user = await UserModel.collection.findOne({ id: '123' });
|
||||
|
||||
@@ -187,7 +190,7 @@ describe('migration.1510174676_user_status', () => {
|
||||
expect(user.status).to.equal('BANNED');
|
||||
|
||||
// Perform the migration.
|
||||
await migration.up();
|
||||
await performMigration();
|
||||
|
||||
user = await UserModel.collection.findOne({ id: '123' });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user