Proje Sorunsal 1

Öncesi: Eslint

Proje için derleme, küçültme, dil denetimi gibi ayarları yapmış, birim testlerimi yazıp işlemlerin çalıştığına emin olmuştum. Ve yazdığım kodu bir tarayıcı üzerinde test etmek istedim. Bunun içinde zaten birim testeri için kullandığım mocha/chai ikilisi ile bir html test sayfası yapmaya karar verdim. Öylede yaptım.

index.html



    
    JSCalculator Tests
    
    


    

Ve testlerimi içerecek javascript dosyamı hazırladım.

index.js
'use strict';
const assert = chai.assert;
const expect = chai.const;
const should = chai.should;
const notEqual = assert.notEqual;
const equal = assert.equal;
const calculator = new Simple();

let container = document.getElementById("container");

before('Setting up Once', function () {
//...
}

after('Teardown Once', function () {
    // runs once after the last test in this block    
});

describe('Dummy String Test', () => {
    it('should return number of charachters in a string', () => {
        notEqual("Hello".length, 4);
    });

    it('should return first charachter of the string', () => {
        equal("Hello".charAt(0), 'H');
    });
});


Geriye tarayıca açıp kodumu test etmek kalmıştı. Ve tadaaa çalışmadı "Simple" diye bir sınıfın ya da metodun tanımsız olduğunu söyleyen bir hata almıştım. Yaptığım onca işlem boşa çıkmıştı. Sil baştan mı başlamam gerekecekti, sorun neydi?


Not:
"https://unpkg.com" adresi nmp kütüphaneleri için bir dağıtım ağı. Bu şekilde yerel olarak kütüphaleri bulundurmak zorunda kalmıyoruz.

Yorumlar

Bu blogdaki popüler yayınlar

Proje Testleri

Proje Başlangıcı

MySQL Error Code: 1175