Snippets Collections
{
    "sqltools.connections": [
        {
            "previewLimit": 50,
            "server": "localhost",
            "port": 5432,
            "driver": "PostgreSQL",
            "name": "memo_wall",
            "database": "memo_wall",
            "username": "junowong",
            "password": "gfHK$dgm6501"
        }
    ]
}
test('adds 1 + 2 to equal 3', () => {
    expect(sum(1, 2)).toBe(3);
});

test('object assignment', () => {
  const data = {one: 1};
  data['two'] = 2;
  expect(data).toEqual({one: 1, two: 2});
});

`toBeNull matches only null
toBeUndefined matches only undefined
toBeDefined is the opposite of toBeUndefined
toBeTruthy matches anything that an if statement treats as true
toBeFalsy matches anything that an if statement treats as false`
yarn add --dev jest
yarn add --dev typescript ts-jest @types/jest @types/node ts-node ts-node-dev
yarn ts-jest config:init
test('should verify typed', async () => {
  const browser = await puppeteer.launch({
    headless: false,
    slowMo: 10,
    args: ['--window-size=1920,1080']
  })
  const page = await browser.newPage()
  await page.goto(url)
  await page.type('.input-text', 'Hello World!')

  const finalText = await page.$eval('input.input-text', el => el.textContent)
  expect(finalText).toBe(finalText)
})
const {getIntroduction} = require('./util')

test('should output name and age', () => {
  const text = getIntroduction('Max', 20)
  expect(text).toBe('Max is 20 years old')
})
"scripts": {
  "test": "jest",
   "start": "node index.js"
},
"devDependencies": {
  "jest": "^26.6.3"
}
test('the data is peanut butter', () => {
  expect.assertions(1);
  return fetchData().then(data => {
    expect(data).toBe('peanut butter');
  });
});
test('the data is peanut butter', done => {
  function callback(data) {
    expect(data).toBe('peanut butter');
    done();
  }

  fetchData(callback);
});
star

Tue Aug 24 2021 05:37:01 GMT+0000 (UTC)

#typescript #jest
star

Mon Aug 23 2021 03:02:12 GMT+0000 (UTC) https://jestjs.io/docs/expect

#typescript #jest
star

Mon Aug 23 2021 02:49:55 GMT+0000 (UTC)

#typescript #jest
star

Sat May 08 2021 17:59:57 GMT+0000 (UTC)

#jest #nodejs #testing
star

Fri Sep 04 2020 05:57:34 GMT+0000 (UTC) https://deltice.github.io/jest/docs/pt-BR/asynchronous.html#content

#javascript #jest
star

Fri Sep 04 2020 05:41:53 GMT+0000 (UTC) https://deltice.github.io/jest/docs/pt-BR/asynchronous.html#content

#javascript #jest

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension