Skip to content

Commit e2fdbc1

Browse files
committed
test
1 parent 85618b8 commit e2fdbc1

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

packages/core/src/test/amazonq/customizationUtil.test.ts

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,16 +82,39 @@ describe('CodeWhisperer-customizationUtils', function () {
8282
assert.strictEqual(actualCustomization.name, selectedCustomization.name)
8383
})
8484

85-
it.skip('Returns AB customization', async function () {
86-
sinon.stub(AuthUtil.instance, 'isValidEnterpriseSsoInUse').returns(true)
85+
it(`setSelectedCsutomization should set correctly if override is false or not specified`, async function () {
86+
await setSelectedCustomization({ arn: 'FOO' }, false)
87+
assert.strictEqual(getSelectedCustomization().arn, 'FOO')
88+
89+
await setSelectedCustomization({ arn: 'BAR' })
90+
assert.strictEqual(getSelectedCustomization().arn, 'BAR')
91+
92+
await setSelectedCustomization({ arn: 'BAZ' })
93+
assert.strictEqual(getSelectedCustomization().arn, 'BAZ')
94+
95+
await setSelectedCustomization({ arn: 'QOO' }, false)
96+
assert.strictEqual(getSelectedCustomization().arn, 'QOO')
97+
})
98+
99+
it(`setSelectedCsutomization should only do once for override per customization arn`, async function () {
100+
await setSelectedCustomization({ arn: 'OVERRIDE' }, true)
101+
assert.strictEqual(getSelectedCustomization().arn, 'OVERRIDE')
102+
103+
await setSelectedCustomization({ arn: 'FOO' }, false)
104+
assert.strictEqual(getSelectedCustomization().arn, 'FOO')
105+
106+
// Should NOT override only happen per customization arn
107+
await setSelectedCustomization({ arn: 'OVERRIDE' }, true)
108+
assert.strictEqual(getSelectedCustomization().arn, 'FOO')
87109

88-
await setSelectedCustomization({
89-
arn: '',
90-
name: '',
91-
})
110+
await setSelectedCustomization({ arn: 'FOO' }, false)
111+
assert.strictEqual(getSelectedCustomization().arn, 'FOO')
92112

93-
const returnedCustomization = getSelectedCustomization()
113+
await setSelectedCustomization({ arn: 'BAR' }, false)
114+
assert.strictEqual(getSelectedCustomization().arn, 'BAR')
94115

95-
assert.strictEqual(returnedCustomization.name, featureCustomization.name)
116+
// Sould override as it's a different arn
117+
await setSelectedCustomization({ arn: 'OVERRIDE_V2' }, true)
118+
assert.strictEqual(getSelectedCustomization().arn, 'OVERRIDE_V2')
96119
})
97120
})

0 commit comments

Comments
 (0)