Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
李楚霏
/
refactorTest
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ad3cf480
authored
May 17, 2020
by
李楚霏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
task-6-subclassing 子类修改测试
parent
f8d48a44
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
28 additions
and
33 deletions
+28
-33
gildedRose/src/AgedBrie.js
+9
-10
gildedRose/src/AgedBrie.test.js
+1
-1
gildedRose/src/BackstagePass.js
+6
-8
gildedRose/src/BackstagePass.test.js
+1
-1
gildedRose/src/Sulfuras.js
+7
-9
gildedRose/src/Sulfuras.test.js
+1
-1
gildedRose/src/item.js
+3
-3
No files found.
gildedRose/src/AgedBrie.js
View file @
ad3cf480
export
class
AgedBrie
{
isAgedBrie
()
{
return
'Aged Brie'
;
}
isSulfuras
()
{
return
'Sulfuras, Hand of Ragnaros'
;
import
{
Item
}
from
"./item"
;
}
export
class
AgedBrie
extends
Item
{
constructor
(
sell_in
,
quality
){
super
(
sell_in
,
quality
);
this
.
name
=
'Aged Brie'
;
};
is
BackStag
e
()
{
return
'
Backstage passes to a TAFKAL80ETC concert
'
;
is
AgedBri
e
()
{
return
'
Aged Brie
'
;
}
}
\ No newline at end of file
gildedRose/src/AgedBrie.test.js
View file @
ad3cf480
...
...
@@ -2,7 +2,7 @@ import { AgedBrie } from "./AgedBrie"
describe
(
'AgedBrieTest'
,
()
=>
{
it
(
'foo'
,
()
=>
{
const
agedBrie
=
new
AgedBrie
();
const
agedBrie
=
new
AgedBrie
(
2
,
0
);
const
string
=
agedBrie
.
isAgedBrie
();
expect
(
string
).
toEqual
(
'Aged Brie'
);
})
...
...
gildedRose/src/BackstagePass.js
View file @
ad3cf480
export
class
BackstagePass
{
isAgedBrie
()
{
return
'Aged Brie'
;
}
isSulfuras
()
{
return
'Sulfuras, Hand of Ragnaros'
;
import
{
Item
}
from
"./item"
;
export
class
BackstagePass
extends
Item
{
constructor
(
sell_in
,
quality
)
{
super
(
sell_in
,
quality
);
this
.
name
=
'Backstage passes to a TAFKAL80ETC concert'
;
}
isBackStage
()
{
return
'Backstage passes to a TAFKAL80ETC concert'
;
}
...
...
gildedRose/src/BackstagePass.test.js
View file @
ad3cf480
...
...
@@ -2,7 +2,7 @@ import { BackstagePass } from "./BackstagePass";
describe
(
'backstagePassTest'
,
()
=>
{
it
(
'foo'
,
()
=>
{
const
agedBrie
=
new
BackstagePass
();
const
agedBrie
=
new
BackstagePass
(
15
,
20
);
const
string
=
agedBrie
.
isBackStage
();
expect
(
string
).
toEqual
(
'Backstage passes to a TAFKAL80ETC concert'
);
})
...
...
gildedRose/src/Sulfuras.js
View file @
ad3cf480
export
class
Sulfuras
{
isAgedBrie
()
{
return
'Aged Brie'
;
import
{
Item
}
from
"./item"
;
export
class
Sulfuras
extends
Item
{
constructor
(
sell_in
,
quality
)
{
super
(
sell_in
,
quality
);
this
.
name
=
'Sulfuras, Hand of Ragnaros'
;
}
isSulfuras
()
{
return
'Sulfuras, Hand of Ragnaros'
;
}
isBackStage
()
{
return
'Backstage passes to a TAFKAL80ETC concert'
;
}
}
\ No newline at end of file
gildedRose/src/Sulfuras.test.js
View file @
ad3cf480
...
...
@@ -2,7 +2,7 @@ import { Sulfuras } from "./Sulfuras";
describe
(
'SulfurasTest'
,
()
=>
{
it
(
'foo'
,
()
=>
{
const
agedBrie
=
new
Sulfuras
();
const
agedBrie
=
new
Sulfuras
(
-
1
,
80
);
const
string
=
agedBrie
.
isSulfuras
();
expect
(
string
).
toEqual
(
'Sulfuras, Hand of Ragnaros'
);
})
...
...
gildedRose/src/item.js
View file @
ad3cf480
...
...
@@ -26,11 +26,11 @@ export class Item {
}
createBackStagePass
(
sell_in
,
quality
)
{
new
Item
(
'Backstage passes to a TAFKAL80ETC concert'
,
sell_in
,
quality
);
new
BackStagePass
(
'Backstage passes to a TAFKAL80ETC concert'
,
sell_in
,
quality
);
}
createSulfuras
(
sell_in
,
quality
)
{
new
Item
(
'Sulfuras, Hand of Ragnaros'
,
sell_in
,
quality
);
new
Sulfuras
(
sell_in
,
quality
);
}
createNormalItem
(
name
,
sell_in
,
quality
)
{
...
...
@@ -38,7 +38,7 @@ export class Item {
}
createAgedBrie
(
sell_in
,
quality
)
{
new
Item
(
'Aged Brie'
,
sell_in
,
quality
);
new
AgedBrie
(
sell_in
,
quality
);
}
_updateItem
(
item
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment