generated from actions/typescript-action
-
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.
- Loading branch information
Showing
5 changed files
with
86 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
isValidMatchPolicy, | ||
isValidTTL, | ||
StackNamePolicy, | ||
TagPolicy | ||
} from '@entities/policies' | ||
|
||
describe('isValidTTL', () => { | ||
it('returns true for valid TTL policies', () => { | ||
expect(isValidTTL({days: 1})).toEqual(true) | ||
expect(isValidTTL({hours: 1})).toEqual(true) | ||
expect(isValidTTL({minutes: 1})).toEqual(true) | ||
}) | ||
|
||
it('treats 0 time units as valid', () => { | ||
expect(isValidTTL({days: 0})).toEqual(true) | ||
expect(isValidTTL({hours: 0})).toEqual(true) | ||
expect(isValidTTL({minutes: 0})).toEqual(true) | ||
}) | ||
|
||
it('returns false for invalid TTL policies', () => { | ||
expect(isValidTTL({})).toEqual(false) | ||
}) | ||
}) | ||
|
||
describe('isValidMatchPolicy', () => { | ||
const namePolicy: StackNamePolicy = {pattern: 'dev'} | ||
const tagPolicy: TagPolicy = {tag: 'env', pattern: 'dev'} | ||
|
||
it('returns true for valid match policies', () => { | ||
expect(isValidMatchPolicy({name: namePolicy})).toEqual(true) | ||
expect(isValidMatchPolicy({tags: [tagPolicy]})).toEqual(true) | ||
}) | ||
|
||
it('returns false for invalid match policies', () => { | ||
expect(isValidMatchPolicy({})).toEqual(false) | ||
expect(isValidMatchPolicy({tags: []})).toEqual(false) | ||
}) | ||
}) |
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