Browse Source

chore(server): Mark populated Customers as verified

Michael Bromley 7 years ago
parent
commit
c527be194f
2 changed files with 5 additions and 5 deletions
  1. 0 5
      server/e2e/test-server.ts
  2. 5 0
      server/mock-data/populate.ts

+ 0 - 5
server/e2e/test-server.ts

@@ -59,10 +59,7 @@ export class TestServer {
      * Populates an .sqlite database file based on the PopulateOptions.
      */
     private async populateInitialData(testingConfig: VendureConfig, options: PopulateOptions): Promise<void> {
-        // Make some specific modifications to the config for the population to work correctly
         (testingConfig.dbConnectionOptions as Mutable<SqljsConnectionOptions>).autoSave = true;
-        const originalRequireVerification = testingConfig.authOptions.requireVerification;
-        testingConfig.authOptions.requireVerification = false;
 
         const app = await populate(testingConfig, this.bootstrapForTesting, {
             logging: false,
@@ -70,9 +67,7 @@ export class TestServer {
         });
         await app.close();
 
-        // Revert the config back to its initial state
         (testingConfig.dbConnectionOptions as Mutable<SqljsConnectionOptions>).autoSave = false;
-        testingConfig.authOptions.requireVerification = originalRequireVerification;
     }
 
     /**

+ 5 - 0
server/mock-data/populate.ts

@@ -27,6 +27,9 @@ export async function populate(
 ): Promise<INestApplication> {
     (config.dbConnectionOptions as any).logging = false;
     const logging = options.logging === undefined ? true : options.logging;
+    const originalRequireVerification = config.authOptions.requireVerification;
+    config.authOptions.requireVerification = false;
+
     setConfig(config);
     await clearAllTables(config.dbConnectionOptions, logging);
     const app = await bootstrapFn(config);
@@ -47,5 +50,7 @@ export async function populate(
     await mockDataService.populateProducts(options.productCount, optionGroupId, assets, taxCategories);
     await mockDataService.populateCustomers(options.customerCount);
     await mockDataService.populateFacets();
+
+    config.authOptions.requireVerification = originalRequireVerification;
     return app;
 }