Skip to content

Instantly share code, notes, and snippets.

View Haosvit's full-sized avatar

Hao Nguyen Haosvit

  • Netherlands
View GitHub Profile
@Haosvit
Haosvit / jest_guide.md
Last active August 19, 2021 13:20
Jest technique
  • use Jest Runner extension: [link]

Debug Jest:

ShallowWrapper {
...
Symbol(enzyme.__node__) {
  props: { // use this to search for item with property:value pair. Ex: wrapper.find('MenuItem[title="View"]')
    children: [{}],
    ...others
  },
@nilcolor
nilcolor / Node.js CORS
Created February 8, 2011 15:28
Node.js cross-origin POST. You should response for OPTIONS request first. Something like this.
if (req.method === 'OPTIONS') {
console.log('!OPTIONS');
var headers = {};
// IE8 does not allow domains to be specified, just the *
// headers["Access-Control-Allow-Origin"] = req.headers.origin;
headers["Access-Control-Allow-Origin"] = "*";
headers["Access-Control-Allow-Methods"] = "POST, GET, PUT, DELETE, OPTIONS";
headers["Access-Control-Allow-Credentials"] = false;
headers["Access-Control-Max-Age"] = '86400'; // 24 hours
headers["Access-Control-Allow-Headers"] = "X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept";