Chai Assert, Validating the Text of a Button

556 Views Asked by At

Newbie here, trying to use Chai to validate that the text of a logInButton = Entrar. The test runs and passes visually but it keeps failing.

0 passing (73ms) 1 failing

 AssertionError: expected 'logInButton' to equal 'Entrar'
  + expected - actual

  -logInButton
  +Entrar

Code:

var assert = require('chai').assert
logInButton = 'Entrar'

assert.strictEqual('logInButton', 'Entrar');

err(function () {
assert.notStrictEqual('logInButton', Entrar);
 }, "Expected 'logInButton' to equal 'Entrar'");

What am I doing wrong?

1

There are 1 best solutions below

0
Andrei Goldmann On

I'm not very familiar with node.js, but I think you want something like this:

assert.strictEqual(logInButton, 'Entrar');

With:

assert.strictEqual('logInButton', 'Entrar');

you are comparing two strings - 'logInButton' and 'Entrar', which of cource are not equal.