1
1
'use strict' ;
2
2
const chai = require ( "chai" ) ,
3
3
expect = chai . expect ,
4
- chaiAsPromised = require ( "chai-as-promised" ) ;
4
+ chaiAsPromised = require ( "chai-as-promised" ) ,
5
+ chalk = require ( 'chalk' ) ;
5
6
6
7
const sinon = require ( "sinon" ) ;
7
8
chai . use ( chaiAsPromised ) ;
@@ -74,3 +75,36 @@ describe("failedSpecsDetails", () => {
74
75
} ) ;
75
76
} ) ;
76
77
} ) ;
78
+
79
+ describe ( "#getSpecStatus" , ( ) => {
80
+
81
+ it ( "returns failed in red if specStatus is failed" , ( ) => {
82
+ let specStatus = "failed" ;
83
+ let response = chalk . red ( specStatus ) ;
84
+ expect ( specDetails . getSpecStatus ( specStatus ) ) . to . eq ( response ) ;
85
+ } ) ;
86
+
87
+ it ( "returns passed_with_skipped in blueBright if specStatus is passed_with_skipped" , ( ) => {
88
+ let specStatus = "passed_with_skipped" ;
89
+ let response = chalk . blueBright ( specStatus ) ;
90
+ expect ( specDetails . getSpecStatus ( specStatus ) ) . to . eq ( response ) ;
91
+ } ) ;
92
+
93
+ it ( "returns pending in blueBright if specStatus is pending" , ( ) => {
94
+ let specStatus = "pending" ;
95
+ let response = chalk . blueBright ( specStatus ) ;
96
+ expect ( specDetails . getSpecStatus ( specStatus ) ) . to . eq ( response ) ;
97
+ } ) ;
98
+
99
+ it ( "returns skipped in blueBright if specStatus is skipped" , ( ) => {
100
+ let specStatus = "skipped" ;
101
+ let response = chalk . blueBright ( specStatus ) ;
102
+ expect ( specDetails . getSpecStatus ( specStatus ) ) . to . eq ( response ) ;
103
+ } ) ;
104
+
105
+ it ( "returns other statuses in yellow if specStatus is other than something known" , ( ) => {
106
+ let specStatus = "xyz" ;
107
+ let response = chalk . yellow ( specStatus ) ;
108
+ expect ( specDetails . getSpecStatus ( specStatus ) ) . to . eq ( response ) ;
109
+ } ) ;
110
+ } ) ;
0 commit comments