@@ -5,31 +5,62 @@ const { expect } = require('../helpers/chai');
55const getBlueprintFilePath = require ( '../../src/get-blueprint-file-path' ) ;
66const path = require ( 'path' ) ;
77
8+ const { getBlueprintRelativeFilePath } = getBlueprintFilePath ;
9+
810describe ( getBlueprintFilePath , function ( ) {
9- it ( 'finds a standard config dir' , async function ( ) {
10- let dir = 'test/fixtures/blueprint/app/local-app/local/my-app' ;
11+ it ( 'doesn\'t have an ember-addon key' , async function ( ) {
12+ let dir = 'test/fixtures/package-json/no-ember-addon' ;
13+ let expected = 'config/ember-cli-update.json' ;
1114
1215 let filePath = await getBlueprintFilePath ( dir ) ;
1316
14- expect ( path . dirname ( filePath ) ) . to . have . basename ( 'config' ) ;
15- expect ( filePath ) . to . be . a . path ( ) ;
17+ expect ( filePath ) . to . endWith ( path . join ( dir , expected ) ) ;
1618 } ) ;
1719
18- it ( 'finds a custom config dir' , async function ( ) {
19- let dir = 'test/fixtures/blueprint/app/legacy-app/local/my-app' ;
20+ it ( 'doesn\'t have a custom config dir' , async function ( ) {
21+ let dir = 'test/fixtures/package-json/no-config-path' ;
22+ let expected = 'config/ember-cli-update.json' ;
2023
2124 let filePath = await getBlueprintFilePath ( dir ) ;
2225
23- expect ( path . dirname ( filePath ) ) . to . not . have . basename ( 'config' ) ;
24- expect ( filePath ) . to . be . a . path ( ) ;
26+ expect ( filePath ) . to . endWith ( path . join ( dir , expected ) ) ;
2527 } ) ;
2628
27- it ( 'falls back if no state file' , async function ( ) {
28- let dir = 'test/fixtures/blueprint/addon/legacy-app/local/no-state-file/my-app' ;
29+ it ( 'uses a custom config dir' , async function ( ) {
30+ let dir = 'test/fixtures/package-json/config-path' ;
31+ let expected = 'config2/ember-cli-update.json' ;
2932
3033 let filePath = await getBlueprintFilePath ( dir ) ;
3134
32- expect ( path . dirname ( filePath ) ) . to . have . basename ( 'config' ) ;
33- expect ( filePath ) . to . not . be . a . path ( ) ;
35+ expect ( filePath ) . to . endWith ( path . join ( dir , expected ) ) ;
36+ } ) ;
37+
38+ describe ( getBlueprintRelativeFilePath , function ( ) {
39+ it ( 'doesn\'t have an ember-addon key' , async function ( ) {
40+ let dir = 'test/fixtures/package-json/no-ember-addon' ;
41+ let expected = 'config/ember-cli-update.json' ;
42+
43+ let filePath = await getBlueprintRelativeFilePath ( dir ) ;
44+
45+ expect ( filePath ) . to . equal ( path . normalize ( expected ) ) ;
46+ } ) ;
47+
48+ it ( 'doesn\'t have a custom config dir' , async function ( ) {
49+ let dir = 'test/fixtures/package-json/no-config-path' ;
50+ let expected = 'config/ember-cli-update.json' ;
51+
52+ let filePath = await getBlueprintRelativeFilePath ( dir ) ;
53+
54+ expect ( filePath ) . to . equal ( path . normalize ( expected ) ) ;
55+ } ) ;
56+
57+ it ( 'uses a custom config dir' , async function ( ) {
58+ let dir = 'test/fixtures/package-json/config-path' ;
59+ let expected = 'config2/ember-cli-update.json' ;
60+
61+ let filePath = await getBlueprintRelativeFilePath ( dir ) ;
62+
63+ expect ( filePath ) . to . equal ( path . normalize ( expected ) ) ;
64+ } ) ;
3465 } ) ;
3566} ) ;
0 commit comments