diff --git a/cypress/integration/api_spec.js b/cypress/integration/api_spec.js index 6fc6b71..d741175 100644 --- a/cypress/integration/api_spec.js +++ b/cypress/integration/api_spec.js @@ -50,3 +50,24 @@ describe('getColor()', function() { // }); // }) }) + +function testPaletteCount(num) { + it(`returns ${num} color when colorCount set to ${num}`, function() { + cy.get(`[data-image="rainbow-horizontal.png"] .palette[data-count="${num}"] .output-palette`).should(($el) => { + const count = rgbCount($el.text()) + expect(count).to.equal(num); + }); + }) +} + +describe('getPalette()', function() { + beforeEach(function() { + cy.visit('http://localhost:8080'); + }) + + // FULL TEST LIST = [1, 2, 3, 5, 7, 10, 20]; + + // Non-breaking tests + let testCounts = [5, 7]; + testCounts.forEach((count) => testPaletteCount(count)) +}) diff --git a/index.html b/index.html index f5982f7..fc6d1bd 100755 --- a/index.html +++ b/index.html @@ -22,7 +22,7 @@