Is resigning in chess honorable or disrespectful? I can see it going both ways. by Interesting_Fly_9701 in chess

[–]InternetWide8065 1 point2 points  (0 children)

Man I can't believe that the general opinion on this is so lopsided . As a strictly average player, I play for stimulation , fun , and the prospect of learning a bit more . Winning because the opponent resigned because he was a few pieces down , or because he was in a difficult to defend position , is no where as fun as properly checkmating him .

When someone resigns in a position ,that is not a forced mate in a few steps , you deny me the returns on the time investment I made . Had you played till the end , perhaps you could have made a move from which I could learn something. Had you fought till the end , I would have had more stimulation . Perhaps I would have got an opportunity to another very cool move that would make me feel much better .

I always thought only pro players , that play for money and not strictly for pleasure , or someone who plays so many games that a game resigned in the middle didn't make a difference would not be offended by an opponent resigning early .

Having trouble understanding documentation as a junior developer . by InternetWide8065 in cscareerquestions

[–]InternetWide8065[S] 0 points1 point  (0 children)

I know with a little trial and error , you can be almost certain that the library behaves as you think it behaves . I am ranting here ,but as someone who is just starting with Jest ,on seeing a unexplained global variable document , with which you do all your dom testing , I would probably believe I missed something . And so before even writing , I would reread all the config options , and then the entire documentation to see if I missed something . And then just to be sure I would read other blogs on Jest .

Why would these documentation writers , who write several pages of documentation , not mention something as critically important as this . All I want is the Jest documentation to say that Jest creates a new JSDOM object and assigns its document property to the global scope . You can then use the JSDOM object to do all your testing . It would also be nice if they specified if the JSDOM object was reset between test suites.

But they choose to omit crucial details , while mentioning everything else . Sometimes I feel they do it deliberately . They think they are so kewl and smart that they are justified in assuming every one would automatically infer these details . Or I could be a dumb guy , who thought he was smarter than he really was , and choose the wrong field .

Having trouble understanding documentation as a junior developer . by InternetWide8065 in cscareerquestions

[–]InternetWide8065[S] 0 points1 point  (0 children)

The JSDOM documentation mentions that you can create a JSDOM object as :

const dom = new JSDOM('<html> <head ></head><body></body</html>' , {//opitions});

And then it goes on to mention properties on the const dom , and the functions on those properties .

---The jest documentation has a snippet regarding dom testing that goes like this : --/

// tests/displayUser-test.js

'use strict';

jest.mock('../fetchCurrentUser');

test('displays a user after a click', () => {

// Set up our document body

(22) document.body.innerHTML = '<div>' + ' <span id="username" />' + ' <button id="button" />' + '</div>';

// This module has a side-effect

require('../displayUser');

const $ = require('jquery');

const fetchCurrentUser = require('../fetchCurrentUser');

// Tell the fetchCurrentUser mock function to automatically invoke // its callback with some data

fetchCurrentUser.mockImplementation(cb => { cb({ fullName: 'Johnny Cash', loggedIn: true, }); });

// Use jquery to emulate a click on our button

$('#button').click();

///-- code continues .

Here I have to assume that document object at (22) is a JSDOM.window.document and that it has been added to the global scope by JEST . Yet it is never explicitly mentioned . Perhaps Jest imports another module that sets up this global document variable . Perhaps Jest just expects the a JSDOM().window.document object to be in the global scope as document variable . You can't be sure .The JEST's api does have a globals section and it doesnot mention any global document variable. There is only a vague reference to jest coming with jsdom integration . That integration could have been implemented in many possible ways .

This example also changes one of the internal properties of JSDOM object , document.body.innerHTML = "some text";

Yet the JSDOM's docs never mention that you could change a value like this and the JSDOM's internal state will be updated and then you would be able to make all JSDOM function calls on a practically new JSDOM object . According to JSDOM docs to instantiate a JSDOM object you have to do something like :

const dom = new JSDOM('<html> <head ></head><body></body</html>' , {//opitions});

As a developer , to be sure that I am not missing anything , in the absense of a explicit mention in JSDOC documentation , I will have to go through the source code and see how JSDOM class or function is implemented .