@@ -18,15 +18,15 @@ test('overrides *must* be arrays', t => {
18
18
t . throws ( ( ) => pluginLoader ( { overrides} ) , / a r r a y / )
19
19
} )
20
20
21
- test ( 'should be able to override a role with multiple fulfillers' , t => {
22
- const role = 'part:foo/bar/baz'
21
+ test ( 'should be able to override a part with multiple fulfillers' , t => {
22
+ const part = 'part:foo/bar/baz'
23
23
const func1 = ( ) => '1'
24
24
const func2 = ( ) => '2'
25
25
26
- const overrides = { [ role ] : [ func1 , func2 ] }
26
+ const overrides = { [ part ] : [ func1 , func2 ] }
27
27
pluginLoader ( { overrides} )
28
- t . is ( require ( role ) , func1 )
29
- t . is ( require ( `all:${ role } ` ) , overrides [ role ] )
28
+ t . is ( require ( part ) , func1 )
29
+ t . is ( require ( `all:${ part } ` ) , overrides [ part ] )
30
30
} )
31
31
32
32
test ( 'should pass unmocked requests onto the default resolver' , t => {
@@ -43,7 +43,7 @@ test('should be able to resolve an actual filesystem structure', t => {
43
43
t . is ( getBar ( ) , 'bar' )
44
44
} )
45
45
46
- test ( 'should be able to require all fulfillers of a role ' , t => {
46
+ test ( 'should be able to require all fulfillers of a part ' , t => {
47
47
const start = Date . now ( )
48
48
pluginLoader ( { basePath : path . join ( __dirname , 'fixture' ) } )
49
49
@@ -56,7 +56,7 @@ test('should be able to require all fulfillers of a role', t => {
56
56
} )
57
57
} )
58
58
59
- test ( 'should be able to include the sanity debug role ' , t => {
59
+ test ( 'should be able to include the sanity debug part ' , t => {
60
60
pluginLoader ( { basePath : path . join ( __dirname , 'fixture' ) } )
61
61
const debug = require ( 'sanity:debug' )
62
62
t . is ( debug . plugins [ 0 ] . name , 'date' )
@@ -99,23 +99,23 @@ test('should be able to load CSS files through PostCSS', t => {
99
99
t . is ( styles . zebra , 'datepicker__zebra___1_qke' )
100
100
} )
101
101
102
- test ( 'should resolve correctly when using optional role requires (?-postfix)' , t => {
102
+ test ( 'should resolve correctly when using optional part requires (?-postfix)' , t => {
103
103
pluginLoader ( { basePath : path . join ( __dirname , 'fixture' ) } )
104
104
105
105
const getBar = require ( 'part:base/bar?' )
106
106
t . is ( require . resolve ( 'part:base/bar?' ) , path . join ( __dirname , 'fixture' , 'getBar.js' ) )
107
107
t . is ( getBar ( ) , 'bar' )
108
108
} )
109
109
110
- test ( 'should resolve correctly when overriding and using optional role requires' , t => {
110
+ test ( 'should resolve correctly when overriding and using optional part requires' , t => {
111
111
const overrides = { 'part:base/bar' : [ 'moo' ] }
112
112
pluginLoader ( { basePath : path . join ( __dirname , 'fixture' ) , overrides} )
113
113
114
114
const bar = require ( 'part:base/bar?' )
115
115
t . is ( bar , 'moo' )
116
116
} )
117
117
118
- test ( 'should return undefined when using optional role requires on an unfulfilled role ' , t => {
118
+ test ( 'should return undefined when using optional part requires on an unfulfilled part ' , t => {
119
119
pluginLoader ( { basePath : path . join ( __dirname , 'fixture' ) } )
120
120
121
121
const result = require ( 'part:not/existant?' )
@@ -128,3 +128,11 @@ test('should resolve parts that point to a path which is a directory containing
128
128
const result = require ( 'part:base/indexpart' )
129
129
t . is ( result ( ) , 'index value' )
130
130
} )
131
+
132
+ test ( 'should be able to override config parts' , t => {
133
+ const overrides = { 'config:sanity' : [ { api : { projectId : 'heisann' } } ] }
134
+ pluginLoader ( { overrides} )
135
+
136
+ const config = require ( 'config:sanity' )
137
+ t . is ( config . api . projectId , 'heisann' )
138
+ } )
0 commit comments