|
1 | | -export type TestCase = { input: string; expected: string; noOfRuns?: number }; |
| 1 | +export type TestCase = { input: string; expected: string; noOfRuns?: number; groupOrder?: string[] }; |
2 | 2 |
|
3 | 3 | export const readmeExample: TestCase = { |
4 | 4 | input: `import fs from 'fs'; |
@@ -116,3 +116,38 @@ export const noImportStatement: TestCase = { |
116 | 116 | input: `const x = 2;`, |
117 | 117 | expected: `const x = 2;`, |
118 | 118 | }; |
| 119 | + |
| 120 | +export const importsOnDifferentGroupOrder: TestCase = { |
| 121 | + groupOrder: ['userLibrary', 'sameModule', 'differentModule', 'thirdParty'], |
| 122 | + input: `import { Component } from '@angular/core'; |
| 123 | +import fs from 'fs'; |
| 124 | +import { LoggerService } from '@myorg/logger'; |
| 125 | +import { Order } from '../order/order.model'; |
| 126 | +import { CustomService } from './customer.service';`, |
| 127 | + expected: `import { LoggerService } from '@myorg/logger'; |
| 128 | +import { CustomService } from './customer.service'; |
| 129 | +import { Order } from '../order/order.model'; |
| 130 | +import { Component } from '@angular/core'; |
| 131 | +import fs from 'fs';`, |
| 132 | +}; |
| 133 | + |
| 134 | +export const importsWithGroupOrderIncorrect: TestCase = { |
| 135 | + groupOrder: ['userLibrary', 'differentModule', 'thirdParty'], |
| 136 | + input: `import fs from 'fs'; |
| 137 | +import { CustomerService } from './customer.service'; |
| 138 | +import { Order } from '../order/order.model'; |
| 139 | +import { Component, OnInit } from '@angular/core'; |
| 140 | +import { LoggerService } from '@myorg/logger'; |
| 141 | +import { Observable } from 'rxjs'; |
| 142 | +import { spawn } from 'child_process';`, |
| 143 | + expected: `import { Component, OnInit } from '@angular/core'; |
| 144 | +import { spawn } from 'child_process'; |
| 145 | +import fs from 'fs'; |
| 146 | +import { Observable } from 'rxjs'; |
| 147 | +
|
| 148 | +import { LoggerService } from '@myorg/logger'; |
| 149 | +
|
| 150 | +import { Order } from '../order/order.model'; |
| 151 | +
|
| 152 | +import { CustomerService } from './customer.service';`, |
| 153 | +}; |
0 commit comments