Git Product home page Git Product logo

Comments (6)

carlhussey avatar carlhussey commented on May 29, 2024 1

I ended up using describe as a around for this. I have both Mocha and Chai installed as packages, but may not be including the right functions from those libraries in my test file.

The following works for me:

const assert = require('assert')
const { expect } = require('chai')
const {
    sequelize,
    dataTypes,
    checkModelName,
    checkPropertyExists
} = require('sequelize-test-helpers')

const CommunicationsModel = require('../models/communications')

/**
 * Database Tests
 */
describe('Database', () => {

    // Check our db model table name
    describe('models/Communications - Table Name Check', () => {
        const Comm = CommunicationsModel(sequelize, dataTypes)
        checkModelName(Comm)('Communications')
    })

    // Check table properties
    describe('models/Communications - Properties Check', () => {
        const Comm = CommunicationsModel(sequelize, dataTypes)
        const instance = new Comm()
            ;['recordID', 'messageUUID', 'firstName', 'lastName', 'age', 'department', 'campus', 'state', 'partition', 'offset'].forEach(
                checkPropertyExists(instance)
            )
    })

})

from sequelize-test-helpers.

davesag avatar davesag commented on May 29, 2024

Are you using Mocha and Chai for your tests?

from sequelize-test-helpers.

davesag avatar davesag commented on May 29, 2024

you can always substitute describe for context — Mocha defines context as a synonym of describe but other test runners maybe don't do that. chai is needed as it's where expect comes from, and I use the spy and stub functions that sinon provides.

from sequelize-test-helpers.

davesag avatar davesag commented on May 29, 2024

Okay good to know.

from sequelize-test-helpers.

Nijinsha avatar Nijinsha commented on May 29, 2024

Is there a context substitute in jest?

from sequelize-test-helpers.

davesag avatar davesag commented on May 29, 2024

Is there a context substitute in jest?

no

from sequelize-test-helpers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.