Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_(10).times(function () {
var user = Factory.build('user')
db.users.push(user)
// Posts
_(10).times(function() {
// userId not set in create so that it appears as the last
// attribute
var post = Factory.build('post', {userId: user.id})
db.posts.push(post)
// Comments
_(5).times(function () {
var comment = Factory.build('comment', {postId: post.id})
db.comments.push(comment)
})
})
_(10).times(function() {
var album = Factory.build('album', {userId: user.id})
db.albums.push(album)
// Photos
_(50).times(function() {
var photo = Factory.build('photo', {albumId: album.id})
db.photos.push(photo)
})
})
_(10).times(function() {
// userId not set in create so that it appears as the last
// attribute
var post = Factory.build('post', {userId: user.id})
db.posts.push(post)
// Comments
_(5).times(function () {
var comment = Factory.build('comment', {postId: post.id})
db.comments.push(comment)
})
})
const mockData = kepler
const subject = Factory.build('subject', { locations: [
{ 'application/json': 'http://localhost:8080/mockData.json' }
] })
const nextSubject = Factory.build('subject', { locations: [
{ 'text/plain': 'http://localhost:8080/nextSubject.json' }
] })
const nextSubjectJSON = { x: [1, 2], y: [3, 4] }
const imageSubject = Factory.build('subject')
const failSubject = Factory.build('subject', {
locations: [
{ 'application/json': 'http://localhost:8080/failure.json' }
]
})
describe('Component > LightCurveViewerContainer', function () {
it('should render without crashing', function () {
wrapper = shallow( {}} setOnPan={() => {}} setOnZoom={() => {}} />)
expect(wrapper).to.be.ok()
})
it('should mount with an initialized state', function () {
wrapper = shallow(
{ }} setOnPan={() => { }} setOnZoom={() => { }} />,
{ disableLifecycleMethods: true }
)
import { FavouritesButton } from '@zooniverse/react-components'
import React from 'react'
import { shallow } from 'enzyme'
import sinon from 'sinon'
import { MetaTools } from './MetaTools'
import Metadata from './components/Metadata'
import CollectionsButton from './components/CollectionsButton'
import { Factory } from 'rosie'
const subjectWithMetadata = Factory.build('subject', { metadata: { foo: 'bar' } })
const favoriteSubject = Factory.build('subject', { favorite: true })
describe('Component > MetaTools', function () {
it('should render without crashing', function () {
const wrapper = shallow()
expect(wrapper).to.be.ok()
})
describe('Metadata', function () {
it('should render a Metadata component', function () {
const wrapper = shallow()
expect(wrapper.find(Metadata)).to.have.lengthOf(1)
})
it('should pass along the isThereMetadata and subject resource metadata props', function () {
const wrapper = shallow()
const metadataComponentProps = wrapper.find(Metadata).props()
id: '51',
strategy: 'singleAnswerQuestion',
failureEnabled: true,
successEnabled: true,
defaultFailureMessage: '"Actually, that\'s not correct"',
defaultSuccessMessage: '"Correct"'
}]
}
}
}
})
const project = ProjectFactory.build({}, {
activeWorkflowId: workflow.id,
experimental_tools: ['general feedback']
})
const subject = Factory.build('subject')
subject.shouldDiscuss = undefined
describe('Model > FeedbackStore', function () {
describe('existance', function () {
it('should exist', function () {
expect(FeedbackStore).to.be.ok()
expect(FeedbackStore).to.be.an('object')
})
})
describe('Actions', function () {
before(function () {
sinon.stub(helpers, 'generateRules').callsFake(() => rulesStub)
strategies.testStrategy = {
reducer: sinon.stub().callsFake(rule => rule)
}
import { FavouritesButton } from '@zooniverse/react-components'
import React from 'react'
import { shallow } from 'enzyme'
import sinon from 'sinon'
import { MetaTools } from './MetaTools'
import Metadata from './components/Metadata'
import CollectionsButton from './components/CollectionsButton'
import { Factory } from 'rosie'
const subjectWithMetadata = Factory.build('subject', { metadata: { foo: 'bar' } })
const favoriteSubject = Factory.build('subject', { favorite: true })
describe('Component > MetaTools', function () {
it('should render without crashing', function () {
const wrapper = shallow()
expect(wrapper).to.be.ok()
})
describe('Metadata', function () {
it('should render a Metadata component', function () {
const wrapper = shallow()
expect(wrapper.find(Metadata)).to.have.lengthOf(1)
})
it('should pass along the isThereMetadata and subject resource metadata props', function () {
_(5).times(function () {
var comment = Factory.build('comment', {postId: post.id})
db.comments.push(comment)
})
})
import { shallow } from 'enzyme'
import React from 'react'
import nock from 'nock'
import sinon from 'sinon'
import * as d3 from 'd3'
import { zip } from 'lodash'
import { LightCurveViewerContainer } from './LightCurveViewerContainer'
import kepler from '../../helpers/mockLightCurves/kepler'
import { Factory } from 'rosie'
let wrapper
const mockData = kepler
const subject = Factory.build('subject', { locations: [
{ 'application/json': 'http://localhost:8080/mockData.json' }
] })
const nextSubject = Factory.build('subject', { locations: [
{ 'text/plain': 'http://localhost:8080/nextSubject.json' }
] })
const nextSubjectJSON = { x: [1, 2], y: [3, 4] }
const imageSubject = Factory.build('subject')
const failSubject = Factory.build('subject', {
locations: [
{ 'application/json': 'http://localhost:8080/failure.json' }
]
})
_(50).times(function() {
var photo = Factory.build('photo', {albumId: album.id})
db.photos.push(photo)
})
})