-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: resolved an issue with target prefixes not being respected
- Loading branch information
1 parent
39c2fb3
commit af7cbdd
Showing
6 changed files
with
121 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { SourceModule } from '..'; | ||
import { KeyInfo } from '../..'; | ||
|
||
describe('SourceModule', () => { | ||
describe('func(prefix)', () => { | ||
class FakeModule extends SourceModule { | ||
get name(): string { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
get originalKeyInfos(): KeyInfo[] { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
source(): Promise<KeyInfo[]> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} | ||
|
||
it('should apply the prefix', async () => { | ||
const module = new FakeModule({ | ||
prefix: 'CI_ONLY_', | ||
targets: [], | ||
}); | ||
|
||
const keyInfos: Promise<KeyInfo[]> = Promise.resolve([ | ||
{ | ||
name: 'HELLO', | ||
value: 'WORLD', | ||
}, | ||
]); | ||
|
||
await expect(module.prefix(keyInfos)).resolves.toEqual([ | ||
{ | ||
name: 'CI_ONLY_HELLO', | ||
value: 'WORLD', | ||
}, | ||
]); | ||
}); | ||
|
||
it('should return the original KeyInfos if no prefix is defined', async () => { | ||
const module = new FakeModule({ | ||
targets: [], | ||
}); | ||
const keyInfos: Promise<KeyInfo[]> = Promise.resolve([ | ||
{ | ||
name: 'HELLO', | ||
value: 'WORLD', | ||
}, | ||
]); | ||
|
||
await expect(module.prefix(keyInfos)).resolves.toEqual([ | ||
{ | ||
name: 'HELLO', | ||
value: 'WORLD', | ||
}, | ||
]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { TargetModule } from '..'; | ||
|
||
describe('TargetModule', () => { | ||
describe('func(prefix)', () => { | ||
class FakeModule extends TargetModule { | ||
get name(): string { | ||
throw new Error('Method not implemented.'); | ||
} | ||
|
||
target(): Promise<void> { | ||
throw new Error('Method not implemented.'); | ||
} | ||
} | ||
|
||
it('should apply the prefix', () => { | ||
const module = new FakeModule({ | ||
prefix: 'CI_ONLY_', | ||
}); | ||
|
||
expect( | ||
module.prefix([ | ||
{ | ||
name: 'HELLO', | ||
value: 'WORLD', | ||
}, | ||
]) | ||
).toEqual([ | ||
{ | ||
name: 'CI_ONLY_HELLO', | ||
value: 'WORLD', | ||
}, | ||
]); | ||
}); | ||
|
||
it('should return the original KeyInfos if no prefix is defined', () => { | ||
const module = new FakeModule({}); | ||
|
||
expect( | ||
module.prefix([ | ||
{ | ||
name: 'HELLO', | ||
value: 'WORLD', | ||
}, | ||
]) | ||
).toEqual([ | ||
{ | ||
name: 'HELLO', | ||
value: 'WORLD', | ||
}, | ||
]); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters