Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/typescript tests #566

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions TypeScript/test/jest/gilded-rose.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { Item, GildedRose } from '@/gilded-rose';
import { Item, GildedRose } from "@/gilded-rose";

describe('Gilded Rose', () => {
it('should foo', () => {
const gildedRose = new GildedRose([new Item('foo', 0, 0)]);
const items = gildedRose.updateQuality();
expect(items[0].name).toBe('fixme');
describe("GildedRose", () => {
describe("updateQuality", () => {
describe("Aged Brie", () => {
it("should increase quality when updateQuality is called", () => {
// Test code here
});

it("should not increase quality above 50", () => {
// Test code here
});

it("should increase quality by 2 after sellIn date has passed", () => {
// Test code here
});
});
});
});
70 changes: 70 additions & 0 deletions ruby/gilded_rose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,74 @@
GildedRose.new(items).update_quality()
expect(items[0].name).to eq "fixme"
end

context 'para items normales' do
before do
## Arrange
@items = [Item.new("foo", 10, 2)]
@gilded = GildedRose.new(@items)
end


it 'decrementa la calidad del item' do
#Act
@gilded.update_quality()

#Assert
expect(@items[0].quality).to eq 1
end

it 'decrementa los dias para vender el item' do
#Act
@gilded.update_quality()

#Assert
expect(@items[0].sell_in).to eq 9
end

it 'decrementa la calidad del item al doble de velocidad cuando ya no quedan dias para venderlo' do
@items[0].sell_in = 0
@items[0].quality = 20

@gilded.update_quality()

expect(@items[0].quality).to eq 18
end

it 'no decrementa la calidad del item a negativo' do
@items[0].quality = 0

@gilded.update_quality()

expect(@items[0].quality).to eq 0
end
end

context 'para items Aged Brie' do
it 'incrementa su calidad'

it 'incrementa su calidad en 2 cuando ya no quedan dias de venta'

it 'no incrementa su calidad por sobre 50'
end

context 'para items Sulfuras' do
it 'no cambia su calidad'

it 'no cambia los dias para venderlo'
end

context 'para items Backstage Pass' do
it 'incrementa su calidad si quedan más de 10 días para venderlo'

it 'incrementa su calidad en 2 si quedan 10 dias o menos para venderlo'

it 'incrementa su calidad en 3 si quedan 5 dias o menos para venderlo'

it 'decrementa su calidad a 0 si ya no quedan dias para venderlo'
end

context 'para items conjurados' do
it 'decrementa su calidad en 2'
end
end