Skip to content

Instantly share code, notes, and snippets.

@samselikoff
Created June 30, 2017 10:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samselikoff/747f07b93fb0dfcc371233fbe3cb5941 to your computer and use it in GitHub Desktop.
Save samselikoff/747f07b93fb0dfcc371233fbe3cb5941 to your computer and use it in GitHub Desktop.
import { test } from 'qunit';
import moduleForAcceptance from 'ember-map/tests/helpers/module-for-acceptance';
moduleForAcceptance('Acceptance | Topic');
test('I should get redirected from /topics to videos.index', function(assert) {
visit('/topics');
andThen(() => {
assert.equal(currentPath(), 'videos.index');
});
});
test('As an unauthenticated user I should see a link in the hero that goes to subscribe', function(assert) {
let series = server.create('series', 'withClips');
visit(`/topics/${series.slug}`);
click(testId('subscribe-link'));
andThen(() => {
assert.equal(currentPath(), 'subscribe.index');
});
});
test('As an authenticated but unsubscribed user I should see a link in the hero that goes to subscribe', function(assert) {
loginUser();
let series = server.create('series', 'withClips');
visit(`/topics/${series.slug}`);
click(testId('subscribe-link'));
andThen(() => {
assert.equal(currentPath(), 'subscribe.index');
});
});
test('As a subscribed user I should see a link in the hero to watch the first video', function(assert) {
let series = server.create('series', 'withClips');
let user = loginUser();
subscribeUser(user);
visit(`/topics/${series.slug}`);
click(testId('start-watching-link'));
andThen(() => {
assert.equal(currentPath(), 'topics.topic.video');
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment