Skip to content

Commit

Permalink
Add tests to cover ssm lookup in companyDomain block.
Browse files Browse the repository at this point in the history
  • Loading branch information
walery committed Aug 9, 2023
1 parent 13f196a commit 868d8ca
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/companyDomain.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,47 @@
const test = require('ava');

test.serial('should resolve ssm:companyDomain if ssm:companyDomain and stencil:companyName and stencil:companyTld provides default values', async t => {
const actual = await resolveCompanyDomain();
t.is(actual, 'ssm.foo');
});

test.serial('should resolve ssm:companyDomain if ssm:companyDomain has overwritten value and stencil:companyName and stencil:companyTld provides default values', async t => {
const mockOverwrites = {
'ssm(us-east-1):/stencil/aws/companyDomain': Promise.resolve('ltd.org'),
};

const actual = await resolveCompanyDomain(mockOverwrites);
t.is(actual, 'ltd.org');
});

test.serial('should resolve ssm:companyDomain if ssm:companyDomain and stencil:companyName are resolvable and stencil:companyTld is not resolvable', async t => {
const mockOverwrites = {
'stencil(account):companyTld': undefined,
};

const actual = await resolveCompanyDomain(mockOverwrites);
t.is(actual, 'ssm.foo');
});

test.serial('should resolve ssm:companyDomain if ssm:companyDomain and stencil:companyTld are resolvable and stencil:companyName is not resolvable', async t => {
const mockOverwrites = {
'stencil(account):companyName': undefined,
};

const actual = await resolveCompanyDomain(mockOverwrites);
t.is(actual, 'ssm.foo');
});

test.serial('should resolve ssm:companyDomain if ssm:companyDomain is resolvable but stencil:companyTld and stencil:companyName are not resolvable', async t => {
const mockOverwrites = {
'stencil(account):companyTld': undefined,
'stencil(account):companyName': undefined,
};

const actual = await resolveCompanyDomain(mockOverwrites);
t.is(actual, 'ssm.foo');
});

test.serial('should resolve compound companyDomain if ssm:companyDomain is not resolvable and stencil:companyName and stencil:companyTld provides default values', async t => {
const mockOverwrites = {
'ssm(us-east-1):/stencil/aws/companyDomain': undefined,
Expand Down

0 comments on commit 868d8ca

Please sign in to comment.