-
Notifications
You must be signed in to change notification settings - Fork 123
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #81 from hemal7735/enhance/log
enhance lib/log.js and test-case
- Loading branch information
Showing
4 changed files
with
60 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
const log = require('./log') | ||
const chalk = require('chalk') | ||
const stripAnsi = require('strip-ansi'); | ||
|
||
test('should return formatted log', async () => { | ||
const org = 'foojs' | ||
const repo = 'barjs' | ||
const issue = { | ||
title: 'Add BAZ support', | ||
pr: 123, | ||
labels: [[Object], [Object], [Object]], | ||
state: 'open', | ||
repo: `https://api.github.com/${org}/${repo}`, | ||
url: `https://github.com/${org}/${repo}/issues/123`, | ||
assignee: null, | ||
assignees: [], | ||
locked: false | ||
} | ||
|
||
const expectedOutput = ` | ||
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ | ||
โ โ | ||
โ Good First Issue in foojs: โ | ||
โ โ | ||
โ - Title: Add BAZ support โ | ||
โ - Repository: foojs/barjs โ | ||
โ - Issue: #123 โ | ||
โ - Status: open โ | ||
โ - Assigned to: unassigned! โ | ||
โ โ | ||
โ Start now: https://github.com/foojs/barjs/issues/123 โ | ||
โ โ | ||
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ | ||
` | ||
|
||
const actualOutput = await log(issue, org) | ||
|
||
expect(expectedOutput).toBe(stripAnsi(actualOutput)) | ||
}) |
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